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)
 string data

Author  Topic 

mkh
Starting Member

18 Posts

Posted - 2004-09-02 : 05:36:44
I have string data in a column eg 'MON2541SEC120504'
I need to separate data MON, 2514, SEC, 150504

I do not know what the delimiter would be most probably there would be no delimiter so it would be fixed as above datalength will not vary or there could be 'space'.

Anyway I need a query to separate this string using single select
will substring work any ideas
regards,
mkh






raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-09-02 : 05:41:38
If the lengths are fixed then substring will do the job.

SELECT SUBSTRING(@String, 1, 3), SUBSTRING(@String, 4, 4), SUBSTRING(@String, 8, 3), SUBSTRING(@String, 11, 6)



Raymond
Go to Top of Page
   

- Advertisement -