Issue while creating DATABSE from a script.

  • I have Generated Script to Create DATABASE .

    The problem I have got now is , instead of creating the DATA File & Log File to the Default Directory (C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA) i need a prompt to appear so that i can specify the directory for creating the database.

    I also need a prompt to appear wherein i can specify the user name & password.

    Please help!!

  • the default directory can be different on every machine.

    take a look at the filepaths from this view:

    select * from master.sys.sysaltfiles

    TSQL does not have any ability to raise a prompt. technically,

    neither does Oracle for example, but all the tools (SQLPLus,Toad) interpret certain commands to be prompts. None of the SQL tools natively do that.

    You'll want to either create an executable which prompts for connection information, variables, and provides them to the script, or provide the values from an ini or config file, or read the values for the path from the existing data in the database.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

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