Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

Function to Expand Tab Characters

By Phil Factor,

This is a function that turns tab characters into spaces. This is not as easy as one might think because of the way that tab characters work. In a non-proportionally spaced text layout, text is positioned according to the number of spaces, which are regarded as being the width of a column. A tab character moves the insertion point to the next tab position. Tab positions are every eighth column.

I suspect that there is an easier way of doing it!- however this routine seems to work and it is fast enough for my purposes.

Total article views: 2051 | Views in the last 30 days: 3
 
Related Articles
FORUM

Detecting Specific Characters in a Varchar Field

spaces or invalid characters

SCRIPT

Get given character's position from a string

Get given character's position from a string

FORUM

Prevent repeating space characters from being stripped from rendered report?

White space is stripped from rendered report. Can we keep the spaces?

BLOG

T-SQL: Identifying, inserting and removing spaces in strings

Frequently, when working with strings you will need to identify, insert or remove spaces before, aft...

FORUM

Special Characters

removing special characters

Tags
string manipulation    
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones