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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 PRINT without losing leading spaces

Author  Topic 

Dev Null
Starting Member

39 Posts

Posted - 2007-04-20 : 16:36:08
This seems like it should be easy to do, but I can't quite make it work...

I've got I varchar(max) field - was a text field, but recently converted - which contains a multi-line description in a Wiki format. As part of an osql script, I want to output this field. Easy, right?

Part of the Wiki formatting uses leading spaces at the start of a line. If I select the field, I get it unchanged, but with column headers which I dont want. If I select it into a variable and print the variable, PRINT strips the leading spaces off the line, ruining the formatting.

Any ideas how to get the content of my field - and only the content of my field - out to stdout unchanged?

Thanks,

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2007-04-20 : 20:36:44
Strange, it works fine from within SMS. A possible workaround is you can replace the first space with a '.' or something. This will hold the formating. I know not ideal, but I don't know what else would resolve that.
Go to Top of Page
   

- Advertisement -