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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 HELP NEEDED (MONITOR BACKUP)

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_id
WHERE
(dbo.sysjobs.name LIKE N'% backu%')

GO

USE master
SELECT
convert(char(20),dbo.sysdatabases.name) AS [BB.DD.]
FROM
sysdatabases

GO

USE msdb
SELECT
command
FROM
sysjobsteps
WHERE
command like '%INIT%'
GO


Can 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 name

select @@servername

inserting data to another server requires linked servers or DTS. look both up in BOL = Books Online = SQL Help

Go with the flow & have fun! Else fight the flow
Go to Top of Page

fvinagre
Starting Member

29 Posts

Posted - 2004-10-11 : 11:02:04
Ok but how i can include @@servername into the query
Go to Top of Page

fvinagre
Starting Member

29 Posts

Posted - 2004-10-11 : 11:02:09
Ok but how i can include @@servername into the query
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-10-11 : 11:10:12
very easy

select @@servername, col1, col2,...
from MyTable

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -