February 10, 2011 at 8:00 am
Hi
i want to execute a function in dynamic sql. is it possible to execute a function in dynamic sql. i tired it but i got a error. please find the below for more clarification
declare @str varchar(50),@sql varchar(max)
select @str='''1'',''2'',''3'',''4''')
set @sql='select data from split('+@str+','','')
execute @sql
i am getting error as incorrect number of arguments
can any one please help me on this
Thanks,
Rock
February 10, 2011 at 8:06 am
you are calling it wrong. try: exec(@sql) or preferrably use sp_executesql
The probability of survival is inversely proportional to the angle of arrival.
February 11, 2011 at 2:07 am
yeah that is ok. I am getting error on execution of the function in dynamic sql. can u give me a sample Dynamic sql code to execute a function with two parameters
ex: select * from split(@var,',')
Thanks in advance
Regards,
Rock.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy