October 30, 2012 at 3:39 pm
I am able to run a query in central management server created on one of the SQL servers lets say CMSServer1.
I would like to store the result set of a query on the same server CMSServer1 in a database/table (TestSQLServer/Table_1) where I created the CMS.
How I do I do this ?
Running this query in CMS :
SELECT@@servername as Servername,name as DBName,[crdate] AS [LastStartupDate]
FROM[master].[dbo].[sysdatabases]
--,[dbo].[Table_1]
WHERE[master].[dbo].[sysdatabases].[name] = 'tempdb'
Can I save the results in a table on the same server where I setup central management server ?
October 31, 2012 at 8:19 am
sqlserver12345 (10/30/2012)
I am able to run a query in central management server created on one of the SQL servers lets say CMSServer1.I would like to store the result set of a query on the same server CMSServer1 in a database/table (TestSQLServer/Table_1) where I created the CMS.
How I do I do this ?
Running this query in CMS :
insert into Table_1
SELECT@@servername as Servername,name as DBName,[crdate] AS [LastStartupDate]
FROM[master].[dbo].[sysdatabases],[dbo].[Table_1]
WHERE[master].[dbo].[sysdatabases].[name] = 'tempdb'
and [TestSQLServer].[dbo].[Table_1].LastStartUpTime < [master].[dbo].[sysdatabases].crdate
Something seems to be missing from your post. What is wrong with the query as you posted it?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply