These are awesome - thanks!!
-----Original Message-----
From: Tad Huck
[mailto:mssqldba-ezmlmshield-x87317362.[Email address protected]
Sent: Wednesday, March 29, 2006 4:02 PM
To: LazyDBA Discussion
Subject: RE: Server and DB info query
/* Determine if and when database backups have been performed.
*/
IF (SELECT count(SUBSTRING(database_name,1,32)) FROM msdb.dbo.backupset)
> 0 BEGIN
PRINT 'The following database backups have occurred:'
SELECT TOP 25 (SUBSTRING(database_name,1,32)) AS
'database_name',
backup_finish_date
FROM msdb.dbo.backupset order by backup_finish_date DESC END
/* Get a list of all the users in this database
* from the sysusers system table.
*/
USE master
PRINT 'The following users exist in the master database:'
SELECT SUBSTRING(A.name,1,30) AS 'Name',
[User] = CASE issqluser
when 1 then 'User ID '
else '--na--'
end,
[NT User] = CASE isntuser
when 1 then 'NT User '
else '--na--'
end,
[NT Group] = CASE isntgroup
when 1 then 'NT Group'
else '--na--'
end,
[SQL Role] = CASE issqlrole
when 1 then 'SQL Role'
else '--na--'
end
FROM sysusers A
ORDER BY [User] DESC
Tad Huck
{Database Czar - " If you can't learn to do something well, learn to
enjoy doing it poorly. "}
REAL PAGE INC.
4000 International Parkway
Carrollton, Texas 75007-1913
(972) 820-3432.
This message is intended only for the use of the individual(s) or entity
to which it is addressed and may contain information that is privileged,
confidential, and/or proprietary to RealPage and its affiliated
companies. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, distribution, forwarding
or copying of this communication is prohibited without the express
permission of the sender. If you have received this communication in
error, please notify the sender immediately and delete the original
message.
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY Website :
http://www.LazyDBA.com To unsubscribe:
http://www.lazydba.com/unsubscribe.html
MS Sql Server LazyDBA home page