When I use a select statement inside store procedured like
SELECT * FROM tableName
开发者_开发技巧
it executes but it is marked as syntax a error,
But if I write
SELECT * FROM 'tableName'
it´s not mark as a syntax error, but when executed, it says:
Msg 102, Level 15, State 1, Procedure proc, Line 264
Incorrect syntax near 'tableName'
How to correct it
As the OP stated in a comment, the syntax error occurs because the table does not exist at design time. The table is created by the stored procedure. I'd consider this to be an acceptable syntax error so long as it is documented inline where it occurs.
精彩评论