SQL Server

Grant Login and Database Access for Hosting a Database with Integrated Security in IIS using ASP.NET 4.0

This is used for moving the database files from one server to another or whenever similar identity elements are changed.

USE GridTrak
EXEC sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE'
EXEC sp_grantdbaccess 'NT AUTHORITY\NETWORK SERVICE'
EXEC sp_grantlogin 'IIS APPPOOL\ASP.NET v4.0'
EXEC sp_grantdbaccess 'IIS APPPOOL\ASP.NET v4.0'

You can also use the sp_grantlogin and sp_grantdbaccess procedures to grant access for User logins.