SELECT @@SERVERNAME
CREATE TABLE #TempSites
(
[Database] varchar(500),
[Site URL] varchar(500),
TimeCreated datetime,
lastAccessDate datetime
)
exec sp_MSforeachdb
'INSERT INTO #TempSites SELECT ''?'',FullUrl AS [Site URL], TimeCreated,
DATEADD(d,DayLastAccessed + 65536, CONVERT(datetime, ''1/1/1899'', 101))
AS lastAccessDate FROM [?].dbo.Webs WHERE
(DayLastAccessed <> 0) AND (FullUrl LIKE N''sites/%'') ORDER BY lastAccessDate'
SELECT * FROM #TempSites
=====================================================Run Above first==========
You will get the data copy in excel then Drop the table
Drop Table #TempSites
# Then Run this
SELECT COUNT(*) FROM sys.databases
To know that how many Total Database you have and compare with Excel DB counts.
CREATE TABLE #TempSites
(
[Database] varchar(500),
[Site URL] varchar(500),
TimeCreated datetime,
lastAccessDate datetime
)
exec sp_MSforeachdb
'INSERT INTO #TempSites SELECT ''?'',FullUrl AS [Site URL], TimeCreated,
DATEADD(d,DayLastAccessed + 65536, CONVERT(datetime, ''1/1/1899'', 101))
AS lastAccessDate FROM [?].dbo.Webs WHERE
(DayLastAccessed <> 0) AND (FullUrl LIKE N''sites/%'') ORDER BY lastAccessDate'
SELECT * FROM #TempSites
=====================================================Run Above first==========
You will get the data copy in excel then Drop the table
Drop Table #TempSites
# Then Run this
SELECT COUNT(*) FROM sys.databases
To know that how many Total Database you have and compare with Excel DB counts.
No comments:
Post a Comment