开发者

Dynamic SQL Execution

Im开发者_C百科 not able to execute below query.Please help.

Declare @i Int
Set @i=1
Exec    ('Create  index  tind'+convert(varchar(20),@i)+  ' on product(qty)')


You can't have an expression as the EXEC argument. Do the dynamic SQL first

Declare @i Int, @sql varchar(1000)
Set @i=1
Set @sql = 'Create index tind'+convert(varchar(20),@i)+ ' on product(qty)'
Exec (@sql)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜