Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. DTS to Import .SQL file

DTS to Import .SQL file

Scheduled Pinned Locked Moved Database
helpdatabasequestion
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paul Hayman
    wrote on last edited by
    #1

    Hi Guys, I have created a program that exports data from our old system to a .sql file that drops/creates and inserts, which works fine, the only problem I have is automating. How do you execute a SQL file from a DTS package? Obviuosly the file changes on a daily basis, but the filename can remain the same. Please help and thanks in advance, Paul.

    M 1 Reply Last reply
    0
    • P Paul Hayman

      Hi Guys, I have created a program that exports data from our old system to a .sql file that drops/creates and inserts, which works fine, the only problem I have is automating. How do you execute a SQL file from a DTS package? Obviuosly the file changes on a daily basis, but the filename can remain the same. Please help and thanks in advance, Paul.

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Paul Hayman wrote:

      How do you execute a SQL file from a DTS package?

      that's a big ask in a forum message, you may find some tutorial and articles on Google [^]though

      Never underestimate the power of human stupidity RAH

      P 1 Reply Last reply
      0
      • M Mycroft Holmes

        Paul Hayman wrote:

        How do you execute a SQL file from a DTS package?

        that's a big ask in a forum message, you may find some tutorial and articles on Google [^]though

        Never underestimate the power of human stupidity RAH

        P Offline
        P Offline
        Paul Hayman
        wrote on last edited by
        #3

        Actually the solution was fairly easy, just a one liner sorted it using sqlcmd. Thanks for your response though it's great that people do actually try and help. Paul.

        M 1 Reply Last reply
        0
        • P Paul Hayman

          Actually the solution was fairly easy, just a one liner sorted it using sqlcmd. Thanks for your response though it's great that people do actually try and help. Paul.

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          So what was the one liner?

          Never underestimate the power of human stupidity RAH

          P 1 Reply Last reply
          0
          • M Mycroft Holmes

            So what was the one liner?

            Never underestimate the power of human stupidity RAH

            P Offline
            P Offline
            Paul Hayman
            wrote on last edited by
            #5

            Sorry, was just happy to have a solution didn't think of posting.... sqlcmd -U USERNAME -P PASSWORD -S SERVER -d DATABASE_NAME -i yourfile.sql Pop that into a bat file and execute from the DTS package as a win32 process, all I need to do now is return a true or false from the bat file and pass back to the DTS package to confirm failure or success. Probably sounds easier than it will be.... Paul.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups