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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-04-20 : 10:00:28
|
| wong writes "HiI would like to know if i can execute a sql statement in a stored procedure. I know it can be done but i wanted the sql string to be dynamic.here's what i mean.Declare @sqlStatement varchar(50)set @sqlStatement='Select * from table'Exec @sqlStatamentThe reason why i do cose is that i can write a case to compare which tables i m using so that i can dynamically change my sql statement. Please advise,Thank you" |
|
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2004-04-20 : 10:06:40
|
| Syntax is EXEC(@Statement). It will run in a stored procedure.Sarah Berger MCSD |
 |
|
|
|
|
|