| Author |
Topic |
|
sqlkid
Starting Member
41 Posts |
Posted - 2009-07-09 : 08:12:37
|
| One column in my table has data with 5 decimal points eg, 27.43152. I am importing the data. When I try to convert the data to decimal type using the following commands :alter table Talter column col003 decimal (10,5)I get the following error msg :Server: Msg 8114, Level 16, State 5, Line 1Error converting data type varchar to numeric.The statement has been terminated. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-09 : 08:16:38
|
| You have bad data on that column. See what this returnsselect col003 from twhere col003 like '%[^0-9]%'MadhivananFailing to plan is Planning to fail |
 |
|
|
sqlkid
Starting Member
41 Posts |
Posted - 2009-07-09 : 08:25:51
|
quote: Originally posted by madhivanan You have bad data on that column. See what this returnsselect col003 from twhere col003 like '%[^0-9]%'MadhivananFailing to plan is Planning to fail
I have got the list of all entries in that column |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-09 : 08:28:22
|
quote: Originally posted by sqlkid
quote: Originally posted by madhivanan You have bad data on that column. See what this returnsselect col003 from twhere col003 like '%[^0-9]%'MadhivananFailing to plan is Planning to fail
I have got the list of all entries in that column
Can you post some of the results?MadhivananFailing to plan is Planning to fail |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-07-09 : 08:29:08
|
I know it is not the best way but in this case try to find bad data using:where isnumeric(col003) <> 1 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-09 : 08:29:41
|
| Try this tooselect col003 from twhere col003 like '%[^0-9.]%'MadhivananFailing to plan is Planning to fail |
 |
|
|
sqlkid
Starting Member
41 Posts |
Posted - 2009-07-09 : 08:30:29
|
| [/quote]Can you post some of the results?MadhivananFailing to plan is Planning to fail[/quote] 6.6968 5.8938 2.5473 5.8938 6.6968 5.8938 5.8974 6.6968 |
 |
|
|
sqlkid
Starting Member
41 Posts |
Posted - 2009-07-10 : 03:49:53
|
quote: Originally posted by webfred I know it is not the best way but in this case try to find bad data using:where isnumeric(col003) <> 1 No, you're never too old to Yak'n'Roll if you're too young to die.
Thanx webfred - I have identified and removed the bad data. But now i have entire rows with no data for any column. how can i delete these ?i tried DELETEFROM TWHERE Col001 IS Null(repeated for all columns) - but the result is 0 rows affected |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-07-10 : 04:07:11
|
DELETE FROM TWHERE COALESCE(Col1, Col2, Col3) IS NULL N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|