call script from another script

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

    call script from another script

    Hello,

    Is it possible with sqlserver to call a sql script from another sql script,
    like @ in oracle ?

    Thanks,

    Olivier


  • Dan Guzman

    #2
    Re: call script from another script

    Is it possible with sqlserver to call a sql script from another sql
    script, like @ in oracle ?
    You can call another script using ":r" in SQLCMD (or SSMS in SQLCMD mode).
    For example:

    :r C:\SqlScripts\S cript1.sql

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP


    "OD" <olivier.dubuis son@free.frwrot e in message
    news:47e8bc04$0 $17714$426a74cc @news.free.fr.. .
    Hello,
    >
    Is it possible with sqlserver to call a sql script from another sql
    script, like @ in oracle ?
    >
    Thanks,
    >
    Olivier
    >

    Comment

    • OD

      #3
      Re: call script from another script

      Thanks, it works very well.

      Is there an equivalent for sqlserver 2000 ?

      Olivier.

      "Dan Guzman" <guzmanda@nospa m-online.sbcgloba l.neta écrit dans le message
      de news: ZU5Gj.5356$6H.4 146@newssvr22.n ews.prodigy.net ...
      >Is it possible with sqlserver to call a sql script from another sql
      >script, like @ in oracle ?
      >
      You can call another script using ":r" in SQLCMD (or SSMS in SQLCMD mode).
      For example:
      >
      :r C:\SqlScripts\S cript1.sql
      >
      --
      Hope this helps.
      >
      Dan Guzman
      SQL Server MVP

      >
      "OD" <olivier.dubuis son@free.frwrot e in message
      news:47e8bc04$0 $17714$426a74cc @news.free.fr.. .
      >Hello,
      >>
      >Is it possible with sqlserver to call a sql script from another sql
      >script, like @ in oracle ?
      >>
      >Thanks,
      >>
      >Olivier
      >>
      >

      Comment

      • Erland Sommarskog

        #4
        Re: call script from another script

        OD (olivier.dubuis son@free.fr) writes:
        Thanks, it works very well.
        >
        Is there an equivalent for sqlserver 2000 ?
        As I recall, :r works in OSQL as well. And OSQL comes with SQL 2000.


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

        Books Online for SQL Server 2005 at

        Books Online for SQL Server 2000 at

        Comment

        Working...