How to create Database on SQL server 20005 using automated scripts

  • Hello Experts,

    I am not a DBA. I have created ABCD database manually and it works file, now I am trying to create ABCD database using scripts. I would like to automate the creation of database using either combination of windows scripts and SQL scripts. I have create_ABCD_DB.SQL script that creates ABCD database and I am trying to find out

    1) how I can execute that create_ABCD_DB.sql from windows 2003 server setup without human interpretation ( I mean using automated scripts)

    2) is there a way that I can create batch script on windows 2003 setup and then use create_ABCD_DB.sql, use db credentials and execute it (on the server where SQL server 2005 is installed) , hoping this will create ABCD database on that server

    Any tips or suggestions or advice is very much appreciated!

    Regards

    🙂

  • You can run the script from anywhere that you have a utility that can connect to the database and run the script. Nothing that comes with a Window Server install can do this by itself. You'll need something else to make the connection. However, nothing should prevent you from connecting to the SQL machine through RDP and running the script that way, or firing a command line & use sqlcmd (you can look that up in Books Online) and run it that way. But you either have to run the script where the SQL Server instance is, or where you have a client tool that can connect.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • check this for automation

    http://www.ruby-lang.org/en/

  • mverma4you (5/21/2009)


    check this for automation

    http://www.ruby-lang.org/en/

    Before I'd go in that direction, I'd look into Powershell. It's going to work as well or better for minor bits of automation, especially within a Windows environment.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply