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 |
|
Nicademas
Starting Member
10 Posts |
Posted - 2009-05-01 : 19:18:42
|
| Hi.I'm curious if I can write out to text or grid what the string I created with dynamic SQL actually looks like (i.e. in lieu of actually executing). That would help considerably!! SQL Server 2008 is being used.Thanks for any thoughts!!Nic |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-05-01 : 19:34:40
|
Yeah, you can use the PRINT statement to print SQL in a variable:DECLARE @sql varchar(max)SET @sql='SELECT * from myTable'PRINT @sql Obviously your code is more complicated, but the idea will work. |
 |
|
|
Nicademas
Starting Member
10 Posts |
Posted - 2009-05-03 : 23:27:34
|
| Perfect. thank you. |
 |
|
|
|
|
|