executing querys from a batch file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • William Kossack

    executing querys from a batch file

    Someone asked me a curious question.

    Can I execute a query to sql server from a bat file? how?

    If not is there a simple scripting laguage that this person might use to
    drive his process that is similar to a dos bat file?
  • Erland Sommarskog

    #2
    Re: executing querys from a batch file

    William Kossack (kossackw@njc.o rg) writes:[color=blue]
    > Someone asked me a curious question.
    >
    > Can I execute a query to sql server from a bat file? how?
    >
    > If not is there a simple scripting laguage that this person might use to
    > drive his process that is similar to a dos bat file?[/color]

    You can use the command-line tool OSQL for this.



    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server SP3 at
    Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.


    Comment

    • William Kossack

      #3
      Re: executing querys from a batch file

      Can you point me to an example or somewhere to look online?

      Erland Sommarskog wrote:
      [color=blue]
      >William Kossack (kossackw@njc.o rg) writes:
      >
      >[color=green]
      >>Someone asked me a curious question.
      >>
      >>Can I execute a query to sql server from a bat file? how?
      >>
      >>If not is there a simple scripting laguage that this person might use to
      >>drive his process that is similar to a dos bat file?
      >>
      >>[/color]
      >
      >You can use the command-line tool OSQL for this.
      >
      >
      >
      >
      >[/color]

      Comment

      • Mike Epprecht \(SQL MVP\)

        #4
        Re: executing querys from a batch file



        --
        --------------------------------
        Mike Epprecht, Microsoft SQL Server MVP
        Zurich, Switzerland

        IM: mike@epprecht.n et

        MVP Program: http://www.microsoft.com/mvp

        Blog: http://www.msmvps.com/epprecht/

        "William Kossack" <kossackw@njc.o rg> wrote in message
        news:11fktjioc9 cp78d@corp.supe rnews.com...[color=blue]
        > Can you point me to an example or somewhere to look online?
        >
        > Erland Sommarskog wrote:
        >[color=green]
        >>William Kossack (kossackw@njc.o rg) writes:
        >>[color=darkred]
        >>>Someone asked me a curious question.
        >>>Can I execute a query to sql server from a bat file? how?
        >>>
        >>>If not is there a simple scripting laguage that this person might use to
        >>>drive his process that is similar to a dos bat file?
        >>>[/color]
        >>
        >>You can use the command-line tool OSQL for this.
        >>
        >>
        >>
        >>[/color][/color]


        Comment

        • Mike Epprecht \(SQL MVP\)

          #5
          Re: executing querys from a batch file

          and


          --
          --------------------------------
          Mike Epprecht, Microsoft SQL Server MVP
          Zurich, Switzerland

          IM: mike@epprecht.n et

          MVP Program: http://www.microsoft.com/mvp

          Blog: http://www.msmvps.com/epprecht/

          "William Kossack" <kossackw@njc.o rg> wrote in message
          news:11fktjioc9 cp78d@corp.supe rnews.com...[color=blue]
          > Can you point me to an example or somewhere to look online?
          >
          > Erland Sommarskog wrote:
          >[color=green]
          >>William Kossack (kossackw@njc.o rg) writes:
          >>[color=darkred]
          >>>Someone asked me a curious question.
          >>>Can I execute a query to sql server from a bat file? how?
          >>>
          >>>If not is there a simple scripting laguage that this person might use to
          >>>drive his process that is similar to a dos bat file?
          >>>[/color]
          >>
          >>You can use the command-line tool OSQL for this.
          >>
          >>
          >>
          >>[/color][/color]


          Comment

          • DosItHelp
            New Member
            • May 2006
            • 1

            #6
            Re: executing querys from a batch file

            For an example how to embed a SQL script within a batch script so that you end up with only one file look here:

            Last edited by DosItHelp; May 4 '06, 04:00 AM.

            Comment

            Working...