sql server - Trouble with SQL Command, with Declaration of table, inserting into it and outputting it -
i'm having trouble making sql command, want declare temporary table, insert stored table, , output id temporary table.
the reason i'm doing this, work around error: "the target table '' of dml statement cannot have enabled triggers if statement contains output clause without clause." caused because use sync framework.
my insert statement is:
declare insertlist table ([listid] int) insert [list] ([listname]) values(@listname) output [inserted].listid insertlist select * insertlist
but error:
"incorrect syntax near keyword 'table'.\r\nincorrect syntax near 'output'."
can help? in advance
variables in sql server starts @ (@) sign, table variables , output clause in wrong place in insert statement.
declare @insertlist table ([listid] int); insert [list] ([listname]) output [inserted].listid @insertlist values(@listname); select * @insertlist;
Comments
Post a Comment