March 28, 2002 at 10:57 am
Is it possible to pass the parameter to the from clause? For example, select @id =max(keyid) from @tablename or insert into @table1 select * from @table2.
Cheers
Dev
Cheers
Dev
March 28, 2002 at 11:28 am
March 28, 2002 at 11:46 am
Do you mean to use exec() function? Yes, it works, but how can I get the result from the dynamic sql, like select @result=max(id) from @tablename. Could you give me an example on how to do that?
quote:
not directly. You can, however, use dynamic sql for this.Steve Jones
Cheers
Dev
Cheers
Dev
March 29, 2002 at 2:27 am
Typically a call to Dynamic SQL would look like EXEC('SELECT ' + @columnname + ' FROM ' + @tablename), but I suspect you know that.
Could you post a fuller example of what you are trying to do.
I have found it is possible to please all of the people all of the time if you do exactly what they want. Harold Macmillan 1961
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply