Archive

Posts Tagged ‘SQL’

How to give a database access to specific users only?

December 4, 2012 Leave a comment

SINGLE_USER allows any single user with permission to access the database.

ALTER DATABASE [Database Name] SET SINGLE_USER

ALTER DATABASE [Database Name] SET Multi_USER
RESTRICTED_USER is the one that limits access to sysadmin, dbowner, or dbcreator

ALTER DATABASE adventureworks
SET restricted_user WITH ROLLBACK IMMEDIATE;
Advertisements

Backup Time Information For a Database

November 30, 2012 Leave a comment

select dbinfo.Name , COALESCE(CONVERT(VARCHAR(20),backuplog.backup_finish_date,100 ),”) as BackupTime
FROM sys.sysdatabases dbinfo
LEFT OUTER JOIN msdb.dbo.backupset backuplog ON backuplog.database_name = dbinfo.name
where dbinfo.Name=’DataBase Name’

%d bloggers like this: