Results 1 to 2 of 2

Thread: ADO, SQL Server Batch files

  1. #1
    MCnKC Guest

    ADO, SQL Server Batch files


    Is there a function in T-SQL similar to Sybase's "READ" where an SQL Batch file is read and the statments are executed from the file? Right now I have all my database scripts hard coded in a VB application. I would like to remove it and just read a text file instead. PLEASE HELP


    For example "READ c:myFile.sql"

    contents of myFile.sql:


    CREATE DATABASE .....

    CREATE Stored Procedure .....


  2. #2
    Chris Thibodeaux Guest

    ADO, SQL Server Batch files (reply)

    You can use OSQL from the command prompt.

    I.E.
    CREATE PROCEDURE
    AS
    EXEC Master..XP_CmdShell 'OSQL {all the switches/path, etc...)'

    Something similar to that.

    -HTH -


    ------------
    MCnKC at 5/8/01 5:08:03 PM


    Is there a function in T-SQL similar to Sybase's "READ" where an SQL Batch file is read and the statments are executed from the file? Right now I have all my database scripts hard coded in a VB application. I would like to remove it and just read a text file instead. PLEASE HELP


    For example "READ c:myFile.sql"

    contents of myFile.sql:


    CREATE DATABASE .....

    CREATE Stored Procedure .....


Posting Permissions

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