Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Deploying a Database - SQL Server

RSS
Modified on Thu, Oct 13, 2011, 2:10 PM by Administrator Categorized as SQL Server
When deploying a SQL Server database for the first time, in addition to distributing the BAK file, you will probably need to create the user and login used by the connection string in your configuration file(s). The following script will do this.

USE [master]
GO
CREATE LOGIN [MyUser] WITH PASSWORD=N'MyPassword', DEFAULT_DATABASE=[master], 
    CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
USE [MyDatabase]
GO
exec sp_change_users_login @Action='Update_One', @UserNamePattern = 'MyUser', @LoginName ='MyUser'
GO

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.