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 |
Expekt
Starting Member
3 Posts |
Posted - 2006-02-21 : 18:40:52
|
I have 2 problems that I need som help with:1. I'm trying to import a semi-comma separated text file into a SQL 2000 db. I have a field in the text file that contains decimal number. As a decimal separator it's used a comma (15,35). When i use a DTS package to create a destination table and import all rows, the field is created as a float field. In this field the decimal comma is removed so the number in SQL becomes 1535. If I change the decimal separator to (.) i works OK. But I need to get it work with comma as decimal separator. In the DTS package the field form the text file is recognised as varchar (8000). Any ideas?2. Need to import a text file without any Identity field into a SQL 2000 table.Before I do I need to verify if the file has been imported earlier.In the text file i have fields that contains year and month information. There are only one year and one month in each text file.I use a DTS package to import the file into a temp table. I then want to check if the month and year in this temp table exists in the destination table before i do a copy table transformation. If there is one or more rows in the dest. table containing the same month and year as in the temp table, then the execution of the package should stop. If not the package should run and drop the temp table after execution.I'm a newbie to DTS and VB and I hope someone can give me some help.Ingar |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-02-21 : 19:21:40
|
quote: But I need to get it work with comma as decimal separator.
Why?If you could provide sample rows of your data for both problems plus what the data should look like after import, then we could better help you out. It's hard to imagine what you want witout seeing data.Tara Kizeraka tduggan |
 |
|
Expekt
Starting Member
3 Posts |
Posted - 2006-02-21 : 19:50:04
|
This a sample text file:GROSSNO;GROSSNAME;INVOICEID;INVOICEDATE;YEAR;MONTH;PRODUCTNO;QUANTITY;NETPRICE7080000082087;Shop1;64889705;20.05.2005 00:00;2005;5;2000;-1;134,177080000082414;Shop2;64674321;20.05.2005 00:00;2005;5;416;1;98,51This is the result in the SQL Table: 7080000082087 BUTIKK1 64889705 20.05.2005 00:00 2005 5 2000 -1 13417 7080000082414 butikk2 64674321 20.05.2005 00:00 2005 7 416 1 9851As you can see the Netprice in the first row, 134,17 becomes 13417.The verify action I would like, is to compare the Year and Month col in the text file(Or actually in the Temp table after the import) against the destianation table. The Temp table will only cointan one month and year as the table is beeing dropped before every new import and the text file is for one month at the time. So if I could test the first row in the temp table against every rows in the destination table it would be great.Ingar |
 |
|
|
|
|