MS SQL Server: How can I add new login and grand permissions for DB using T-SQL

0

I need to be able to establish an ODBC connection through SQL Server authentication.

How can I grant permissions for an user with ALL rights on DB?

Please help :)

Tags: ,

1 Answer

I found solution:

CREATE DATABASE <DB name>
CREATE LOGIN <login name> WITH PASSWORD = 'aaaaaa' with default_database = <DB name>
GO
USE <DB name>
CREATE USER <User name> FROM LOGIN <login name>
EXEC sp_addrolemember 'db_owner', '<User name>'
GO

It's all :)

0

Post Answer