controlling length of text for print command | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

controlling length of text for print command

I use the PRINT command to output informational messages within my procedure. There seems to be a 79 character limit to the PRINT command before a line break occurs. This makes the output less visually pleasing. Is there any way to control how many characters are printed before a line break occurs with the PRINT command? Thanks,
Jethro
I believe you can control number of character to be printed on one row by using a varchar(7<img src=’/community/emoticons/emotion-11.gif’ alt=’8)’ /> and use TRIM functions accordingly to format the result. I havne’t used PRINT before but I’m sure you’ll get to it with fellow members help.<br /><br /><hr noshade size="1"><b>Satya SKJ</b><br />Moderator<br /<a target="_blank" href=http://www.SQL-Server-Performance.Com/forum>http://www.SQL-Server-Performance.Com/forum</a><br /><center><font color="teal"><font size="1">This posting is provided “AS IS” with no rights for the sake of <i>knowledge sharing.</i></font id="size1"></font id="teal"></center>
You watching the output from Query Analyzer? —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

quote:There seems to be a 79 character limit to the PRINT command before a line break occurs
Not sure what you are saying
Run this and see whether it prints 100 ‘a’s print replicate(‘a’,100) Madhivanan Failing to plan is Planning to fail
That’s why I was asking. In QA your statement works fine. Even with larger number than 100. [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />–<br />Frank Kalis<br />Microsoft SQL Server MVP<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />Ich unterstütze PASS Deutschland e.V. <a target="_blank" href=http://www.sqlpass.de>http://www.sqlpass.de</a>) <br />
I have PRINT statement inside a procedure for informational and error messages. I execute a bat file that connects to the SQL Server instance via OSQL and execute the procedure in question and output the resulting PRINT output to a log file. I get the same result if I connect to the instance with OSQL and execute the following with 80 characters: 1> PRINT ‘aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa’
2> go
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
a I think I have to use the -w option in OSQL to increase the size of the column. I have tested it with the command above and it seems to be working. I will need to run it in the bat file to confirm. Have just ran the bat file and everything is fine now. PRINT output is on one single line with no break. The -w option allowed longer lenght lines. Thanks for everyone’s commands. Jethro.
]]>