Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fvinagre
Starting Member
29 Posts |
Posted - 2004-10-11 : 10:47:39
|
| Hi I need help with an issue. I would like create a repository with the results of backups of serveral servers I have a query that show me part of the data that i need. I would like include the nane of the server in each row.Also I want instert the restult of the query in the repository (a SQL server database in other server)Here is the query:SELECT DISTINCT convert(char(8),cast(cast(dbo.sysjobschedules.next_run_date AS char(8)) AS datetime),3) AS [Próximo día], dbo.sysjobschedules.next_run_time AS Hora, dbo.sysjobservers.last_run_outcome AS [O.K.=1], dbo.sysjobs.enabled AS [Habil.=1], convert(char(20),dbo.sysjobs.name) AS [BB.DD.], dbo.sysjobservers.last_run_duration AS [Dur. seg.], dbo.sysjobservers.last_run_date AS [Última ejecución], dbo.sysjobservers.last_run_time AS [zzzz]FROM dbo.sysjobs INNER JOIN dbo.sysjobschedules ON dbo.sysjobs.job_id = dbo.sysjobschedules.job_id INNER JOIN dbo.sysjobservers ON dbo.sysjobs.job_id = dbo.sysjobservers.job_idWHERE (dbo.sysjobs.name LIKE N'% backu%')GOUSE masterSELECT convert(char(20),dbo.sysdatabases.name) AS [BB.DD.]FROM sysdatabasesGOUSE msdbSELECT commandFROM sysjobstepsWHERE command like '%INIT%'GOCan you help me with this???Thanks in advance Fernando |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-10-11 : 10:52:15
|
well this will get you the server nameselect @@servernameinserting data to another server requires linked servers or DTS. look both up in BOL = Books Online = SQL HelpGo with the flow & have fun! Else fight the flow |
 |
|
|
fvinagre
Starting Member
29 Posts |
Posted - 2004-10-11 : 11:02:04
|
| Ok but how i can include @@servername into the query |
 |
|
|
fvinagre
Starting Member
29 Posts |
Posted - 2004-10-11 : 11:02:09
|
| Ok but how i can include @@servername into the query |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-10-11 : 11:10:12
|
very easy select @@servername, col1, col2,...from MyTableGo with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|
|
|