February 12, 2010 at 12:06 pm
Hello all
How to Create new database using strore procedure without using system Admin.
Please help.
thanks.
February 12, 2010 at 12:23 pm
You need to be a dbcreator on the server at least.
February 12, 2010 at 12:30 pm
Hi Hawkeye_DBA
How you do that? Please help.
Thanks
February 12, 2010 at 5:07 pm
You will have to contact your database administrator and have them add you as a dbcreator role to the database server you wish to create the database on.
Hope that helps!
February 16, 2010 at 2:31 pm
Hi Hawkeye_DBA,
Create user = Test1 with sql login have read and wirte to sql database name = testdatabase.
With this sql login user =Test1 possible can they create new database?
I create strore procedure and let user execute as the own to create new database on Dev and QA
I can't paste all codes in to this text
Please help!
Thanks
February 18, 2010 at 6:26 am
I'm sorry, I guess I don't understand? Are you trying to script a CREATE DATABASE procedure? BOL has the definition of how to do this, however I'll post that here if perhaps you don't have access to it.
Connect to a database server
CREATE DATABASE database_name
[DATABASEPASSWORD 'database_password'
[ENCRYPTION {ON|OFF}]
]
[COLLATE collation_name comparison_style]
database password ::= identifier
EXAMPLE creating a SQL Server 2005 compatible database, you will have to fill in the <DataFilePath> and <LogFilePath> as well as
set the desired size and growth increments and change the database name to your desired name.
Also, if you want to set any of the database properties just use an ALTER DATABASE command (i.e. [MyDatabase] SET ANSI_NULL_DEFAULT OFF) after you create the database.
CREATE DATABASE [MyDatabase] ON PRIMARY
( NAME = N'MyDatabase', FILENAME = N'DriveLetter:\<DataFilePath<\MyDatabase.mdf' , SIZE = 2KB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
LOG ON
( NAME = N'MyDatabase_log', FILENAME = N'DriveLetter:\<LogFilePath>\MyDatabase_log.LDF' , SIZE = 1KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'MyDatabase', @new_cmptlevel=90
GO
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply