Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Is there a way to break up a string within a view?

Author  Topic 

smithsf22
Starting Member

9 Posts

Posted - 2006-12-21 : 09:37:40
Hello,
I have been trying to do this for a while with no luck. Is there a way to break a string like this 06-26-002-30-1 so it will display like in 5 different columns like 06 26 002 30 1 within a view?
Thank you

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-21 : 09:44:54
1 If you store the data hyphen seperated, you should consider Normalisation
2 If you use front end application like Vb, make use of split function
Split(col,"-")
3 http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648 - to do it in sql


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-21 : 09:50:12
Use this function here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033

select blablabla,
dbo.fnParseString(5, ' ', yourcolumn),
dbo.fnParseString(4, ' ', yourcolumn),
dbo.fnParseString(3, ' ', yourcolumn),
dbo.fnParseString(2, ' ', yourcolumn),
dbo.fnParseString(1, ' ', yourcolumn)
from <yourview>


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

smithsf22
Starting Member

9 Posts

Posted - 2006-12-21 : 10:10:10
Great... thanks for the help got it
Go to Top of Page
   

- Advertisement -