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 |
|
dr223
Constraint Violating Yak Guru
444 Posts |
Posted - 2011-03-31 : 05:36:52
|
| Hi, I am working with SQL Server 2005, and I would like to import a flat file to a table.. Sample of the flat file is shown below; Data1 Data2 Data3 Data43 4.4 133 260 13 2.38 96 03 2.111 1.87 413 0I have tried to set the datatypes for Data1, Data2, Data3, Data4 as 1) numerical(16,3)2) decimal (16,3)3) Nvarchar(50)In all occassions the import fails, I receive a conversion error.. What datatypes will suit my table to accept the spreadsheet.. Many Thanks |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2011-03-31 : 06:13:46
|
| Import as varchar--------------------------http://connectsql.blogspot.com/ |
 |
|
|
dr223
Constraint Violating Yak Guru
444 Posts |
Posted - 2011-04-04 : 06:43:21
|
| varchar never worked.. When I import the flat file and make SQL server ro generate the table - I manage to get the table successfully however the data is wrong. For example; patid enttype adid data1 data2 data3 data4 data5 data6 data71566 1 3 20 50 1566 13 1 30 0 7.5Results after the import:patid enttype adid data1 data2 data3 data4 data5 data6 data71566 1 3 20 50 1566 13 1 30 0 7.5Notice - 2 spaces before 1566 at data3 and space between 0 and 7 at data7. Also, these shoule be 2 records, therefore data3- data7 should be NULL. Instead these should be set as the second record on the table as per the flat file.Whats wrong? Why I dont receive similar results as the flat file.. Thanks |
 |
|
|
|
|
|