2
我想在存储过程中创建包含此变量的SQL变量表;在存储过程中创建SQL变量表
Select a,b,c,d from **@tablename** where a=1 and c=0
创建sp时如何做到这一点?
我想在存储过程中创建包含此变量的SQL变量表;在存储过程中创建SQL变量表
Select a,b,c,d from **@tablename** where a=1 and c=0
创建sp时如何做到这一点?
您可以在SP申报表变量为:
DECLARE @tablename TABLE(
a INT,
b INT,
c INT,
d INT);
SELECT * FROM @tablename;
请参阅此链接http://www.codeproject.com/Articles/18972/Temporary-Tables-vs-Table-Variables-and-Their- Effe –
您需要使用动态SQL将表名称作为参数包含在SQL查询中。 –
这是数据库设计不好的标志。 –