Create DatabaseServicedb on Primary(Name='Servicedb_data',--logical name of the master data fileFileName='D:\WebRoot\DB\ServiceDB_data.mdf',--physical name of the master data fileSize=5MB,--Initial size of master data fileMaxSize=100MB,--maximum number of main data file growthFileGrowth=Ten% --growth rate of master data files)Log on(Name='Servicedb_log', filename='D:\WebRoot\DB\ServiceDB_log.ldf', size=2MB, FileGrowth=1MB)GO --Create a login account UseMasterGOEXECSp_addlogin'server_guest','123456'--EXEC sp_droplogin ' server_guest '--Delete login account UseServicedbGO--Create a database userEXECsp_grantdbaccess'server_guest'GO--drop Schema [server_guest]--Delete schema--Drop User server_guest--delete database user --Assign permissions to the specified databaseGrant Select,Insert,Delete,Update,References,Alter,exec on Database:: Servicedb toserver_guest with Grant optionGO
SQL Server build Library & user-assigned permissions