Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    8

    Unanswered: use DTS to import csv file data

    I have a .csv-file which is imported into my database using DTS.
    When look at the DTS package in design-mode i can see that it creates a table and then copies the data from the file into the created table.

    Nothing wrong there.

    But when the contents of the file changes (e.g. column added or removed) the create table script raises an error. The script is not dynamic, it is created when the package is created and only changes when the package itself is re-created.

    Is there a way to make the create table script be dynamic so that the table is dropped re-created according to the format of the .csv-file?

    Thanks in advance

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    DBJournal article about DTS.

    http://www.sqldts.com/default.aspx?231 for information about changing the filename dynamically.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    Mar 2004
    Posts
    8
    Thanks for your fast reply, but i don't want to change the name of the file but the data in the file. I created the DTS-package and in it is a create table task. When i change the contents of the file by adding or removing a column the create table task is corrupt because it creates a table where there's a column too many or missing.
    Because the contents of the file can be dynamic i want the create table task to be dynamic.

    Thanks in advance haastnooit

  4. #4
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Why not create a temp table with the changed structure and use DTS again to pop into orginal tables with required columns.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •