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 |
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-08-30 : 09:09:02
|
If I have a temp table with a colum of data that is currently either 2,3,4,5,6 numbers long, and I want to trim the colum so that all value are 2 numbers long, the first 2 numbers how would i do that? ExamplecurrentIDNUMBER102344599909873432i wantidnumber1023990934 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-08-30 : 09:10:30
|
UPDATE TempTable SET IDNUMBER = LEFT(IDNUMBER, 2)Better is to insert the corrected value from start.Peter LarssonHelsingborg, Sweden |
 |
|
Vivaldi
Constraint Violating Yak Guru
298 Posts |
Posted - 2006-08-30 : 09:12:28
|
Select LEFT(cast(idnumber as varchar(10)),2)________________________________________________I am a man, I can change, if I have to, I guess. |
 |
|
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-08-30 : 09:13:45
|
I appreciate the quick reply, my issue with doing it from the start is its just more manual work. Today I have to import the data into excel, trim down the colum first, and than import the data. Dont even get me started on why the data doesnt show up right to begin with, arrgghhhh.thanks again, you guys rock |
 |
|
|
|
|
|
|