Friday, May 21, 2010
User mapping in SQL Server 2005
--- Change database owner
EXEC [AdventureWorks].dbo.sp_changedbowner @loginame = N'sa', @map = false
GO
--- Create database user to map SQL login account
CREATE USER [testdbuser] FOR LOGIN [testserverlogin]
--- Rename database user to a new name
ALTER USER [testdbuser] WITH NAME = NewNametestdbuser;
--- map database user to a SQL login account and Default Schema
ALTER USER [testdbuser] WITH login = [testserverlogin];
ALTER USER [testdbuser] WITH login = [testserverlogin] ,DEFAULT_SCHEMA =dbo;
EXEC [AdventureWorks].dbo.sp_changedbowner @loginame = N'sa', @map = false
GO
--- Create database user to map SQL login account
CREATE USER [testdbuser] FOR LOGIN [testserverlogin]
--- Rename database user to a new name
ALTER USER [testdbuser] WITH NAME = NewNametestdbuser;
--- map database user to a SQL login account and Default Schema
ALTER USER [testdbuser] WITH login = [testserverlogin];
ALTER USER [testdbuser] WITH login = [testserverlogin] ,DEFAULT_SCHEMA =dbo;
Thursday, May 20, 2010
Wednesday, May 19, 2010
Error log in SQL 2005 management
Using xp_ReadErrorLog in SQL Server 2005
http://www.sqlteam.com/article/using-xp_readerrorlog-in-sql-server-2005
CREATE TABLE FarlowErrorLog
(
RowID int IDENTITY PRIMARY KEY,
EntryTime datetime,
source varchar(50),
LogEntry varchar(4000)
)
insert into FarlowErrorLog (entrytime, source, logentry)
execute master..xp_readerrorlog
Monitor the SQL Server Error Log
http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=ErrorLogMon
db_Executor Role – updated
CREATE ROLE db_executor
GRANT EXECUTE TO db_executor
EXEC sp_addrolemember 'db_executor', 'username'
http://benchmarkitconsulting.com/colin-stasiuk/2009/01/27/db_executor-role/
GRANT EXECUTE TO db_executor
EXEC sp_addrolemember 'db_executor', 'username'
http://benchmarkitconsulting.com/colin-stasiuk/2009/01/27/db_executor-role/
Subscribe to:
Posts (Atom)