in operator issue in sql server -


declare @ls_sql char(100) declare @sql varchar(max) set @ls_sql=ltrim('''stock in hand'',''store'',''product''')  set @sql='select * item groupname in(' + rtrim(@ls_sql) + ')' print @sql execute @sql 

result

select * item groupname in('stock in hand','store','product') msg 2812, level 16, state 62, line 9 not find stored procedure 'select * item groupname in('stock in hand','store','product')'.

this command

execute @sql 

run procedure. if wan run dynamic sql should use below command:

exec (@sql) 

you can use

execute sp_sqlexec @sql 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -