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.
Author |
Topic |
haroon2k9
Constraint Violating Yak Guru
328 Posts |
Posted - 2010-10-29 : 07:48:55
|
hi,i have a column name as "Helpdeskid" and value asHelpdeskidHD-001HD-002HD-003---HD-1000HD-1000000HD-10000000--------------i just waantto split and reslut must be123456...10001000001000000100000000pl help me.. |
|
notmyrealname
98 Posts |
Posted - 2010-10-29 : 08:07:19
|
CAST(SUBSTRING([Helpdeskid], CHARINDEX('-', [Helpdeskid]) + 1, LEN([Helpdeskid])) AS int)Search help for SQL String Functions. You will find lots of useful functions that help with this kind of stuff. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-29 : 08:11:50
|
select convert(int,replace(Helpdeskid,'HD-','')) No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-10-29 : 08:29:00
|
select convert(int,RIGHT(helpdeskid, LEN(helpdeskid) - 3))Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
|
|
notmyrealname
98 Posts |
Posted - 2010-10-29 : 08:30:51
|
quote: Originally posted by webfred select convert(int,replace(Helpdeskid,'HD-','')) No, you're never too old to Yak'n'Roll if you're too young to die.
Why didn't i think of that! Nice! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-01 : 07:28:20
|
orselect parsename(replace(Helpdeskid ,'-','.'),1)*1 from tableMadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|