Import Text File on remote server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Forbes

    Import Text File on remote server

    Hi there,

    When importing a text file using SQL Server, how do I specify the path
    to a file on the same remote server that SQL Server is running on? I
    tried //c:/filename but that doesn't seem to work.

    Also, once the import is working, how do I write a DTS package to
    first delete all rows in a table, then repopulate with the text file,
    or is it easier to drop the table, re-create it and then repopulate?
    The table will contain approximately 30,000 records.

    thanks for your help,
    K
  • Dan Guzman

    #2
    Re: Import Text File on remote server

    Exactly how are you importing the file? If this is a DTS Bulk Insert task
    or T-SQL BULK INSERT statement, you can specify 'c:/filename' to import a
    file that is on the same machine as the SQL Server.

    In the case of a DTS Transformation, the path is relative to the machine one
    which the DTS package executes. The path is the same as above if the DTS
    package is run on the SQL Server.

    You can truncate the table in your DTS package with an Execute SQL task that
    executes TRUNCATE TABLE. Specify the task a workflow predecessor so that it
    runs before your import.

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    "Kevin Forbes" <kevinforbes@ya hoo.com> wrote in message
    news:2550077b.0 401251322.506ef d08@posting.goo gle.com...[color=blue]
    > Hi there,
    >
    > When importing a text file using SQL Server, how do I specify the path
    > to a file on the same remote server that SQL Server is running on? I
    > tried //c:/filename but that doesn't seem to work.
    >
    > Also, once the import is working, how do I write a DTS package to
    > first delete all rows in a table, then repopulate with the text file,
    > or is it easier to drop the table, re-create it and then repopulate?
    > The table will contain approximately 30,000 records.
    >
    > thanks for your help,
    > K[/color]


    Comment

    • Chuck Conover

      #3
      Re: Import Text File on remote server

      Kevin,
      There are some great lessons on importing and DTS packages on our site
      at www.TechnicalVideos.net. Also covers creating data imports, stored
      procedures and temporary tables.

      Best regards,
      Chuck Conover




      "Kevin Forbes" <kevinforbes@ya hoo.com> wrote in message
      news:2550077b.0 401251322.506ef d08@posting.goo gle.com...[color=blue]
      > Hi there,
      >
      > When importing a text file using SQL Server, how do I specify the path
      > to a file on the same remote server that SQL Server is running on? I
      > tried //c:/filename but that doesn't seem to work.
      >
      > Also, once the import is working, how do I write a DTS package to
      > first delete all rows in a table, then repopulate with the text file,
      > or is it easier to drop the table, re-create it and then repopulate?
      > The table will contain approximately 30,000 records.
      >
      > thanks for your help,
      > K[/color]


      Comment

      • John Bell

        #4
        Re: Import Text File on remote server

        Hi

        As well as looking through Books online the following web site

        is well worth a look.

        You can use the TRUNCATE TABLE statement see books online:

        mk:@MSITStore:C :\Program%20Fil es\Microsoft%20 SQL%20Server\80 \Tools\Books\ts q
        lref.chm::/ts_ta-tz_2hk5.htm

        from a Execute SQL Task

        mk:@MSITStore:C :\Program%20Fil es\Microsoft%20 SQL%20Server\80 \Tools\Books\dt s
        sql.chm::/dts_elemtsk2_3e 0b.htm

        The input file specification will be local to the server it is being
        executed on, therefore c:\filename should be ok.


        John

        "Kevin Forbes" <kevinforbes@ya hoo.com> wrote in message
        news:2550077b.0 401251322.506ef d08@posting.goo gle.com...[color=blue]
        > Hi there,
        >
        > When importing a text file using SQL Server, how do I specify the path
        > to a file on the same remote server that SQL Server is running on? I
        > tried //c:/filename but that doesn't seem to work.
        >
        > Also, once the import is working, how do I write a DTS package to
        > first delete all rows in a table, then repopulate with the text file,
        > or is it easier to drop the table, re-create it and then repopulate?
        > The table will contain approximately 30,000 records.
        >
        > thanks for your help,
        > K[/color]


        Comment

        • Kevin Forbes

          #5
          Re: Import Text File on remote server

          Thanks for your help,

          I was just using the import data wizard and then saving it as a DTS
          package, I don't know much about DTS programming but will give your
          suggestions a try.

          thank you,
          K

          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          Working...