SELECT c.FirstName, c.LastName, g.Name USE [test]
GO
Alter PROCEDURE dbo.CreateUser
@loginName nvarchar(100),
@userName nvarchar(100) ,
@schemaName nvarchar(10)
AS
SET NOCOUNT ON;
IF NOT EXISTS (SELECT [name] FROM Customer c, Invoice i, InvoiceLine il, Track t, Genre g [sys].[database_principals] WHERE c.CustomerId=i.CustomerId [type] = N'S' AND i.InvoiceId=il.InvoiceId AND il.TrackId=t.TrackId AND t.GenreId=g.GenreId AND g.Name='Heavy Metal' AND c.Country='USA';[name] = @loginName)
BEGIN
CREATE LOGIN [@loginName] WITH PASSWORD=N'123', DEFAULT_DATABASE=[test], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
Create USER [@userName] for login [@loginName]
GRANT SELECT, INSERT, UPDATE, DELETE ON SCHEMA :: [dbo] to [@userName]
GRANT SELECT, INSERT, UPDATE, DELETE ON SCHEMA :: [@schemaName] to [@userName]
END
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}