CREATE APPLICATION ROLE DataWareHouseApp
WITH PASSWORD = 'YourPass',
DEFAULT_SCHEMA = dbo
-- Now grant this application role permissions
GRANT SELECT ON YourTable1
TO DataWareHouseApp
EXEC sp_setapprole 'DataWareHouseApp', -- App role name
'YourPass' -- Password
-- Works
SELECT COUNT(*) FROM YourTable1
ALTER APPLICATION ROLE DataWareHouseApp
WITH NAME = DW_App, PASSWORD = 'YourPass2'
DROP APPLICATION ROLE DW_App
|