<ten.
@dnartreb.noraa> wrote:
>> But when I use query :"exec sp_executesql ...." goes wrong.
>Could you possibly show us THAT code? Everything so far has been a wild
>goose chase, because we're trying to spot errors in code you're not even
>using.
go ok. Is there a difference to use "exec sp_executesql "?
-----------------------------------------------Reply-----------------------------------------------
> this query returns error:"Error converting data
> type varchar to datatime.".
When I these queries, I get the error "There are more columns in the INSERT
statement than values specified in the VALUES clause. The number of values
in the VALUES clause must match the number of columns specified in the
INSERT statement.". This is expected because only 2 values are specified
although 3 columns are specified in the column list.
> go ok. Is there a difference to use "exec sp_executesql "?
No, the interpretation of data strings is the same.
Please post code that actually reproduces the error, including CREATE TABLE
statements. This will better help us identify the reason for your error.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"karol1208" <karol1208(Cut this)@gazeta.pl> wrote in message
news:b33t535q6lm4ira2ocot9oqcbrdnnveajs@4ax.com...
> On Wed, 30 May 2007 12:46:48 -0400, "Aaron Bertrand [SQL Server MVP]"
> <ten.
@dnartreb.noraa> wrote:
>>> But when I use query :"exec sp_executesql ...." goes wrong.
>>Could you possibly show us THAT code? Everything so far has been a wild
>>goose chase, because we're trying to spot errors in code you're not even
>>using.
> exec sp_executesql N'INSERT INTO doc (
> doc_Id,dok_Typ,coc_Date)
> VALUES
> (@P1,@P2)',
> N' @P1 int,@P2 datetime',
> 12,'2007-05-29 00:00:00'
> this query returns error:"Error converting data
> type varchar to datatime.".
> But this
> INSERT INTO doc ( doc_Id,dok_Typ,coc_Date)
> VALUES (12,'2007-05-29 00:00:00')
> go ok. Is there a difference to use "exec sp_executesql "?