sql server mcps sqlserver - ghdrako/doc_snipets GitHub Wiki

  1. Start instance using single user mode
"c:\Program Files (x86)\Microsoft SQL Server\MSSQL11.SQLEXPRESS2012\MSSQL\Binn\sqlservr.exe" -m -sSQLEXPRESS2012

lub w serwisie w opcjach dodac opcje –f or –m i uruchomic servis. Agent musi byc wylaczony bo zajmie to jedyne polaczenie.

  1. SQLCMD –S <Server_Name\Instance_Name>
sqlcmd -S PC118333\SQLEXPRESS2012
>CREATE LOGIN [CONTOSO\PatK] FROM WINDOWS;   CREATE LOGIN [BANK\SN1402431] FROM WINDOWS;
i
>ALTER SERVER ROLE sysadmin ADD MEMBER [CONTOSO\PatK];   ALTER SERVER ROLE sysadmin ADD MEMBER [BANK\SN1402431];
lub
>P_ADDSRVROLEMEMBER ‘<Login_Name>’,’SYSADMIN’
>go

detach w starej wersji i atache w nowej w MCPS Database Manager

⚠️ **GitHub.com Fallback** ⚠️