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

Too many commands? Learning new language?

FavScripts.com is a free tool that allows you to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.

Boost your daily productivity with FavScripts.com!

Post Answer