Char(9) doesn't print tab in Sql server 2005
17,871
Solution 1
If you're testing this inside of Management Studio, the Results to Grid
(Ctrl + D) setting will change your tab to a space... try switching to Results to Text
(Ctrl + T) instead, and you will see the tab.
Alternately, you can change your select
to a print
:
print 'tab-->' + char(9) + '<--tab'
Outputs...
tab--> <--tab
Solution 2
- Tool -> Options -> Query Results -> SQL Server -> Results to Grid -> Retain CR/LF on copy or save
- Restart SSMS
Author by
shrekDeep
Updated on August 05, 2022Comments
-
shrekDeep almost 2 years
I am trying to print a tab in sql server using:
select 'tab-->' + char(9) + '<--tab'
But it doesn't seem to work and always prints
tab--> <--tab
Is there any thing I am missing?
-
Ben Thul almost 12 yearsI tested "select '>' + char(9) + '<'" with results to grid and still get a tab.
-
Michael Fredrickson almost 12 years@BenThul On what version of SSMS? I tested in SSMS 2005 and I don't get the tab with results to grid...