SqlServer 添加用户和设置db权限
"CREATE LOGIN ["+newDbName+"] WITH PASSWORD=N'"+newDbName+"', DEFAULT_DATABASE=["+newDbName+"], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF;"// 将CHECK_POLICY=OFF 是降低了windows的密码复杂度EXEC sp_addlogin 'userName','passWord','defaultDataBase';//默认使用windows的密码复杂度."use "+newDbName+";"EXEC sp_adduser ["+newDbName+"], ["+newDbName+"], 'db_owner';