sql server sp_executesql动态sql

 

declare @count_sql nvarchar(max),@count int
set @count_sql = 'select @vlaue = count(1) from t_dd_qm_product_testitem_course with (nolock) where group_number in ('+@group_number_str+')';
exec sp_executesql @count_sql,N'@vlaue int output',@count output
print @count

 

posted @ 2022-07-12 17:39  单纯的桃子  阅读(116)  评论(0编辑  收藏  举报