Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ceate user with OSQL 1

Status
Not open for further replies.

olekr

Instructor
May 27, 2001
19
NO
Hi and heeeelp!
Can you help me how to create a new database "Test", with user "Hank", password "PASS"?? Must have rights to make tables, procedures and triggers.
Thanks. Ole
 
Hi Ole

The following script will do it for you:

use master
go
-- create the database...this is the basic statement without
-- specify size or filegroup
CREATE DATABASE Test
GO
--create login and specify default database
EXEC sp_addlogin 'HANK', 'PASS', 'Test'
GO
-- specify database
use test
go
-- grant permissions
GRANT CREATE TABLE, CREATE DATABASE, CREATE PROCEDURE
TO test
GO

Something to note is that you can't grant or revoke permissions to create triggers.

Alternatively right click on databases in Enterprise Mng, Create Database...select options.

Under security in EM right click Logons, choose options, default database, password and database access.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top