Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to create database using T-SQL?

Author  Topic 

Wodzu
Yak Posting Veteran

58 Posts

Posted - 2007-10-02 : 05:08:59
Hello, topic says it all :)

I would like to execute a T-SQL script and create a new database with a given name in a given path. Then I would like to create an user with given name, password and permissions ;)

How can I do this? Thanks for any help.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-02 : 05:15:52
Look up CREATE DATABASE and GRANT PERMISSION syntax in Books Online.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Wodzu
Yak Posting Veteran

58 Posts

Posted - 2007-10-02 : 09:22:13
quote:
Originally posted by Peso

Look up CREATE DATABASE and GRANT PERMISSION syntax in Books Online.



Thanks.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2007-10-03 : 06:21:51
If it is a copy of an existing db , there are mechanisms that allow you to generate scripts within the db , to create the CREATE script. It's worth looking at it to study all the various options

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com/SQL
Go to Top of Page

Wodzu
Yak Posting Veteran

58 Posts

Posted - 2007-10-03 : 10:41:46
It will not be a copy but i think i can just use osql instead.
Go to Top of Page
   

- Advertisement -