[CODE SQL]
SET @newsql_1 = 'INSERT INTO @egbs_1 VALUES ( ' + @newsql_1 + ' )'
EXEC sp_executesql @newsql_1
SELECT * FROM @egbs_1
[/CODE]
This project is just a thorn in my side! Okay, so the code being passed to sp_executesql here, @newsql_1 had an ORDER BY clause in it. Of course, INSERT wants nothing to do with an ORDER BY clause, so I replaced the ORDER BY with '/*' and appended a '*/' to the end of the string. Is it valid to pass comments like this to sp_executesql?
v/r
Gooser
Why do today
that which may not need to be done tomorrow --me