Skip to content

Instantly share code, notes, and snippets.

@anzekrpic
anzekrpic / Create Azure login and user.sql
Created March 24, 2015 13:24
Sample for creating login and user for Azure website
CREATE LOGIN [mySampleWeb]
WITH PASSWORD = N'NePovem';
GO
CREATE USER [mySampleWeb] FOR LOGIN [mySampleWeb] WITH DEFAULT_SCHEMA=[dbo]
GO
EXEC sp_addrolemember 'db_datareader', 'mySampleWeb';
EXEC sp_addrolemember 'db_datawriter', 'mySampleWeb';
@anzekrpic
anzekrpic / Login and user template
Created March 24, 2015 13:30
Template for creating login and user
CREATE LOGIN [<SQL_login_name, sysname, login_name> ]
WITH PASSWORD = N'<password, sysname, Change_Password>';
GO
CREATE USER [<SQL_login_name, sysname, login_name> ] FOR LOGIN [<SQL_login_name, sysname, login_name> ] WITH DEFAULT_SCHEMA=[dbo]
GO
EXEC sp_addrolemember 'db_datareader', '<SQL_login_name, sysname, login_name> ';
EXEC sp_addrolemember 'db_datawriter', '<SQL_login_name, sysname, login_name> ';
@anzekrpic
anzekrpic / MEcount.sql
Last active August 24, 2016 12:19
AX modelElements in models between build versions
select mf.name, count(*)as 'Element count' from modelelementdata med
join modelmanifest mf on mf.modelid = med.modelid
where mf.VersionBuildNo between 1000 and 3999
group by mf.name