Wednesday, 20 July 2011

Find out any Login created or updated in last week

PRINT '=========================='
print '   LOGIN UPDATE DETAILS   '
PRINT '=========================='
select CONVERT(VARCHAR(15), loginname) loginname,CONVERT(VARCHAR(10), dbname) dbname, updatedate  from master..syslogins   where  convert(varchar(8),updatedate,112)>   convert(varchar(8),getdate()- 7,112) and createdate <> updatedate
PRINT '=========================='
print '       LOGIN DETAILS      '
PRINT '=========================='
select CONVERT(VARCHAR(15), loginname) loginname, CONVERT(VARCHAR(10), dbname) dbname, createdate from master..syslogins   where convert(varchar(8),createdate,112) > convert(varchar(8),getdate()- 7,112)

No comments:

Post a Comment