Groups | Blog | Home
all groups > sql server clients > july 2003 >

sql server clients : Split value in deferent columns


Allan Mitchell
7/28/2003 8:06:14 AM
For that specific val you have given have a look at these
SELECT
FirstCol = LEFT(REPLACE('1988@@57@@5185','@',''),4),
SecondCol = SUBSTRING(REPLACE('1988@@57@@5185','@',''),5,2),
ThirdCol = SUBSTRING(REPLACE('1988@@57@@5185','@',''),7,4)


--OR

SELECT
FirstCol = SUBSTRING('1988@@57@@5185',1,4),
SecondCol = SUBSTRING('1988@@57@@5185',7,2),
ThirdCol = SUBSTRING('1988@@57@@5185',11,4)

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



[quoted text, click to view]

Farhan Iqbal
7/28/2003 11:44:29 AM
hi,
1988@@57@@5185

I want to split upper value in three deferent column and want values like
this

col1 = 1988

col2 = 57

col3 = 5185



is there any why to split this value in desired fashion?

Thanx

Farhan Iqbal

Farhan Iqbal
7/28/2003 12:06:00 PM
One more thing I am accessing this value from Table and data length can vary
but separator always @@

[quoted text, click to view]

AddThis Social Bookmark Button