Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

split strings into tikens

Status
Not open for further replies.

notlimah

IS-IT--Management
Nov 13, 2004
14
0
0
JM
let suppose i had a string like "2 21 31 4 3 5"
# being the delimitter how could i split this strings in tokens... 2,21,31,4,3,5
what string functions in sql server are avialable for this
 
try using SPLIT. Sorry dont have full syntax, but have a look at books online


"I'm living so far beyond my income that we may almost be said to be living apart
 
SPLIT doesn't do that. Split breaks UPDATEs into a DELETE and INSERT.

You say # is the delimiter, but your example: 2 21 31 4 3 5
doesn't have any # symbols. So are the numbers separated by a space or by the #?

You could try REPLACE:

SELECT REPLACE(column_name, ' ', ',')

Refer to the BOL for more information on REPLACE.

-SQLBill

BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top