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 |
|
JezLisle
Posting Yak Master
132 Posts |
Posted - 2010-01-25 : 11:28:26
|
| I have a VARCHAR reference field that is like LB1 to LB500How can I split the numeric value out and use it in a field that is and INT datatype?having a blank day |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-01-27 : 02:57:50
|
quote: Originally posted by X002548 Are the first 2 bytes alway Alpha?We need more sample DataBut could be as simple asSELECT CONVERT(int, SUBSTRING(Col1,3,LEN(COL1) -1)) FROM ( SELECT 'LB1' AS Col1 UNION ALL SELECT 'LB500' AS Col1) AS XXX Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam
Would you expect 0 for LB?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|