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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 conversion nvarchar to numeric on the fly fails

Author  Topic 

mary_itohan
Posting Yak Master

191 Posts

Posted - 2014-04-25 : 07:17:35
Hello guys,
I am importing from one table to another.

I have a table with over 10,000 records, and want to import into another table with numeric values.

Here is my code, please advise, thanks


insert into dbo.Products_Product_Range_MAM

( PartNo, Descriptions, KnownAs, SupportPart, RRP, Vat_Inc_Re, NNP, NSP_Cont, NSP_Su_G, NSP_Gold, NSP_Silver, NSP_Bronze, NSP_Fore, NSP_Taxi, Groups, Ranges, Cont_Disc, Su_G_Disc, Silv_Disc, Bron_Disc, Fore_Disc, Taxi_Disc, UOI, Surch_In, Surch_Out, Box_Qty, MinOrder, XREF, xref2)
select testing, testing1, testing2, testing3, testing4, convert(numeric(18,6),testing5), testing6, testing7, testing8,
testing9, testing10, testing11, testing12, testing13, testing14, testing15, testing16, testing17, testing18, testing19, testing20, testing21, testing22, testing23, testing24, testing25, testing26, testing27, testing28

from csv_testing



Error line is in red above

_____________________


Yes O !

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2014-04-25 : 07:23:17
select * from csv_testing
where isnumeric(testing5) = 0

That is the first step you do to find rows where the data in testing5 can't be converted...


Too old to Rock'n'Roll too young to die.
Go to Top of Page

mary_itohan
Posting Yak Master

191 Posts

Posted - 2014-04-25 : 09:00:49
Ok thanks it worked.



_____________________


Yes O !
Go to Top of Page
   

- Advertisement -