![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I have two types of ascii files. File1 Col1;Col2;Col3 10,11;8,00;2,99 File2 Col1;Col2;Col3 10.11;8.00;2.99 ; = col separator and , . are decimal marks. I import files by DTS and File2 works fine but File 1 is a problem. I get general conversion failure source col DBTYPE_STR and destination col DBTYPE_NUMERIC What should I do? Many thanks in advance!!! |
#3
| |||
| |||
|
|
-----Original Message----- The fact that you have , as the decimal notation is your problem here. have a look at this declare @s varchar(50) declare @num decimal(3,2) set @s = '123,34' set @num = @s select @num Server: Msg 8114, Level 16, State 5, Line 4 Error converting data type varchar to numeric. What i would be inclined to do is to import the file as is into a staging area (varchar attributes) and do your manipulation from there so either do a mass update on each attribute UPDATE TABLE SET col1 = REPLACE (col1,',','.).................. Or you can do it in your select when you go to put it back into SQL Server SEELCT REPLACE(col1,',','.) as col1,............... FROM TABLE -- -- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.konesans.com - Consultancy from the people who know "Kari" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message news:3f2e01c472ee$2003cf40$a301280a (AT) phx (DOT) gbl... Hi, I have two types of ascii files. File1 Col1;Col2;Col3 10,11;8,00;2,99 File2 Col1;Col2;Col3 10.11;8.00;2.99 ; = col separator and , . are decimal marks. I import files by DTS and File2 works fine but File 1 is a problem. I get general conversion failure source col DBTYPE_STR and destination col DBTYPE_NUMERIC What should I do? Many thanks in advance!!! . |
![]() |
| Thread Tools | |
| Display Modes | |
| |