Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Mark
Starting Member
48 Posts |
Posted - 2001-01-30 : 12:48:07
|
| I have a variable that is created by a series of if statements:@sql = 'select * from table where'if @country <> '' (if country is not empty) @sql = @sql + 'where country = ' + @countryif city <> '' @sql = @sql + 'and city = '+@city(not quite exactly... the statements to build are a little more complicated. )I now have a @sql var that contains a statement. is it possible to execute this var as a statement?execute @sql maybe?any comments will help |
|
|
|
|
|