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 |
kemi2299
Starting Member
41 Posts |
Posted - 2008-04-28 : 10:24:23
|
hi,could you pls help me out to change to tsql statement, can't seem to get anywhere.thanksn3=LEFT(RIGHT(CHAR(NHS_Num,15,1), |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-28 : 10:27:54
|
quote: Originally posted by kemi2299 hi,could you pls help me out to change to tsql statement, can't seem to get anywhere.thanksn3=LEFT(RIGHT(CHAR(NHS_Num,15,1),
Post some sample data with expected resultMadhivananFailing to plan is Planning to fail |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-28 : 10:28:51
|
You may want to haven3=LEFT(RIGHT(CHAR(NHS_Num),15),1),MadhivananFailing to plan is Planning to fail |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-28 : 10:37:46
|
SELECT SUBSTRING(CAST(NHS_Num AS VARCHAR(8000)), LEN(NHS_Num) - 14, 1) E 12°55'05.25"N 56°04'39.16" |
 |
|
kemi2299
Starting Member
41 Posts |
Posted - 2008-04-28 : 12:23:40
|
hi guys,thanks for your help,I run this statement and i get the error statement belown3=LEFT(RIGHT(CHAR(NHS_Num),15),1),The conversion of the varchar value '4628174520' overflowed an int column. Maximum integer value exceeded.the second solution is not running. |
 |
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2008-04-28 : 12:31:26
|
I don't understand what you are trying to do. NHS numbers are always 10 digits long.http://www.connectingforhealth.nhs.uk/systemsandservices/nhsnumber |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-28 : 12:32:02
|
Seems like n3 is an integer column to which you're assiging value of a varchar column. The value happens to be outside range of integer data type. So based on your requirement either make n3 bigint datatype or keep it as varchar itself. |
 |
|
|
|
|
|
|