EXEC sp_configure 'CONTAINED DATABASE AUTHENTICATION', 1
GO
RECONFIGURE
GO

USE [master]
GO

CREATE DATABASE demo;
GO

ALTER DATABASE [demo] SET CONTAINMENT = PARTIAL
GO

USE [demo];
GO

CREATE USER demo_user WITH PASSWORD = 'pas$w0rd';
GO

CREATE TABLE Products (ID int, ProductName nvarchar(max));
GO

GRANT SELECT ON OBJECT::dbo.Products TO demo_user;
GRANT INSERT ON OBJECT::dbo.Products TO demo_user;
GRANT UPDATE ON OBJECT::dbo.Products TO demo_user;
GRANT DELETE ON OBJECT::dbo.Products TO demo_user;
