开发者

Stored procedure in SQL Server

Can I use only one stored procedure for many queries?

Like this:

SELECT @var开发者_C百科_name[0] from @table_name WHERE @con1 = @var_name[1] ;


You cannot do that. You could build the query dyamically with something like

EXEC('SELECT ' + @var_name + ' FROM ' + @table_name + ' WHERE ' + @Con1 + ' = ' + @var_name)

Be aware of potential performance and sql injection issues when doing this though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜