MSSQL 为db创建user
use [IBatisNet]
GO
if not exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
BEGIN
CREATE LOGIN [IBatisNet] WITH PASSWORD = 'IBatisNetTest', DEFAULT_DATABASE = IBatisNet, DEFAULT_LANGUAGE = us_english, CHECK_POLICY = OFF
--exec sp_addlogin N'IBatisNet', @loginpass, @logindb, @loginlang //此方法在未来的sql server中会被废弃。宜用CREATE LOGIN 方法代替之。
END
GO
if not exists (select * from dbo.sysusers where name = N'IBatisNet' and uid < 16382)
EXEC sp_grantdbaccess N'IBatisNet', N'IBatisNet'
GO
exec sp_addrolemember N'db_owner', N'IBatisNet'
GO