Grant NT AUTHORITY\NETWORK SERVICE login and database access to a SQL Server database

To grant NT AUTHORITY\NETWORK SERVICE login and database access to a SQL Server database, you can execute the following Transact-SQL code:

EXEC sp_grantlogin N’NT AUTHORITY\NETWORK SERVICE’

EXEC sp_grantdbaccess N’NT AUTHORITY\NETWORK SERVICE’

IMPORTANT NOTE:

  • sp_grantlogin creates a SQL Server login. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use CREATE LOGIN instead.
  • sp_grantdbaccess adds a database user to the current database. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use CREATE USER instead.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: