Create azure sql user

by Damiaan Peeters 11. June 2012 14:22

Just a small note for myself on creating sql user using the SQL statements.

Connect to the MASTER and create a login.

create login myNewLogin with password = 'myPassword'

The connect to the database itself and give the new login access

create user myNewUser FOR LOGIN myNewLogin

EXEC sp_addrolemember N'db_datareader', N'myNewUser'
EXEC sp_addrolemember N'db_datawriter', N'myNewUser'

 

There is a lot to read on MSDN

MSSQL error message: "Property Owner is not available for Database [databaseName]"

by Damiaan Peeters 22. June 2008 10:43

Problem

When i clicked on the properties of the Database, I got this error on 2 of my Microsoft SQL Server 2005 databases.

image

TITLE: Microsoft SQL Server Management Studio

Cannot show requested dialog.

ADDITIONAL INFORMATION:

Cannot show requested dialog. (SqlMgmt)

Property Owner is not available for Database '[myDatabaseName]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.PropertyCannotBeRetrievedExceptionText&EvtID=Owner&LinkId=20476

Cause

I have restored this databases in the past from other server's backup, and my original login is apparerently not available on target server.

image

Solution

You can fix it with 'sp_changedbowner sa'.

update:
I removed '2005' the subject of this post because you can have this error message on the Newer SQL Server 2008 also.

update 2:
The syntax to use in SQL Server Management Studio is:

use myDBName
EXEC sp_changedbowner 'sa'

Who.I.am

Certified Umbraco Master, Part of Umbraco Certified partner comm-it, .Net and Azure developer, seo lover. Magician in my spare time.

Month List