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 |
|
binuj
Starting Member
5 Posts |
Posted - 2008-11-06 : 05:11:58
|
| Hi, My records:12~4561~34523~56734~3333~444I need to extract the first 2 digits and do some calculation. I extracted by using the Substring function. now the problem is the nvarchar character (~) is giving error when doing some calculation.Please help me in this. How will i extract teh digit without (~) character. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-06 : 05:17:18
|
[code]DECLARE @Sample TABLE ( data VARCHAR(20) )INSERT @SampleSELECT '12~456' UNION ALLSELECT '1~345' UNION ALLSELECT '23~567' UNION ALLSELECT '34~333' UNION ALLSELECT '3~444'SELECT data, PARSENAME(REPLACE(data, '~', '.'), 2), PARSENAME(REPLACE(data, '~', '.'), 1)FROM @Sample[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
binuj
Starting Member
5 Posts |
Posted - 2008-11-06 : 06:13:39
|
| Thanks a ton.......it is working fine.....the best forum for SQL Server MAY GOD BLESS YOU ALL |
 |
|
|
|
|
|