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

0
=
0
+
0
No specific Bitcoin Bounty has been announced by author. Still, anyone could send Bitcoin Tips to those who provide a good answer.
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

1
=
0
=
$0
Internet users could send Bitcoin Tips to you if they like your 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 :)

SEND BITCOIN TIPS
0

Too many commands? Learning new syntax?

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

Boost your productivity with FavScripts.com!

Post Answer