Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

CMS Expand / Collapse
Author
Message
Posted Tuesday, October 30, 2012 3:39 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, March 26, 2014 5:09 PM
Points: 178, Visits: 579
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 ?
Post #1379055
Posted Wednesday, October 31, 2012 8:19 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:21 PM
Points: 13,083, Visits: 11,918
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1379339
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse