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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2010-08-02 : 11:37:44
|
Hi,How is it possible to format the sql output inside a dynamic sql?For example, I am building a dynamic sql something like:set @sql = @sql + 'declare @table1 table (id int)'set @sql = @sql + ' declare @table2 table (id int)'@print @sqlThe sql output is not formatted so that the second sql appears right after the end of the first sql on one line.How is it possible to add something like a linefeed so that the sql is shown nicely?Thanks |
|
Kristen
Test
22859 Posts |
Posted - 2010-08-02 : 11:50:18
|
set @sql = @sql + 'declare @table1 table (id int)'+CHAR(13)+CHAR(10)set @sql = @sql + ' declare @table2 table (id int)'and optionally delete the leading space on the second SET command's string |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2010-08-02 : 11:57:09
|
Many thanks |
 |
|
|
|
|