There are well-known ways to execute strings. Although I am not especially good at it, here is one way: exec (@functionstring)
BUT, of course, the command within that string has to itself be executable, right? i.e. you can't just key getdate() into Query Analyzer and expect anything good to happen, because it is not directly executable like that. Likewise, you can set a string = 'getdate()' as you have done, and then try to execute that string, but nothing good is going to happen.
However, here is something that can be done, for example:
declare @functionstring varchar(255)
set @functionstring = 'Select getdate()'
exec (@functionstring)
----------------------
I don't know if I cleared anything up for you or not.
bperry
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.