sys.servers issues

  • In sql server 2005, the following query does not work? could anyone suggestion me what is the worng?

    SELECT B.name as Database_Name, ISNULL(STR(ABS(DATEDIFF(day, GetDate(),

    MAX(Backup_finish_date)))), 'NEVER') as DaysSinceLastBackup,

    ISNULL(Convert(char(10), MAX(backup_finish_date), 101), 'NEVER') as LastBackupDate

    FROM master..sys.databases B LEFT OUTER JOIN msdb.dbo.backupset A

    ON A.database_name = B.name AND A.type = 'D' GROUP BY B.Name ORDER BY B.name;

    Error:

    Msg 7202, Level 11, State 2, Line 1

    Could not find server 'master' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

    I could not get idea, Tried to exec this query running on local in master database, but err msg is addlinkedserver .

    Thanks

  • ananda.murugesan (9/11/2009)


    In sql server 2005, the following query does not work? could anyone suggestion me what is the worng?

    SELECT B.name as Database_Name, ISNULL(STR(ABS(DATEDIFF(day, GetDate(),

    MAX(Backup_finish_date)))), 'NEVER') as DaysSinceLastBackup,

    ISNULL(Convert(char(10), MAX(backup_finish_date), 101), 'NEVER') as LastBackupDate

    FROM master..sys.databases B LEFT OUTER JOIN msdb.dbo.backupset A

    ON A.database_name = B.name AND A.type = 'D' GROUP BY B.Name ORDER BY B.name;

    Error:

    Msg 7202, Level 11, State 2, Line 1

    Could not find server 'master' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

    I could not get idea, Tried to exec this query running on local in master database, but err msg is addlinkedserver .

    Thanks

    This will work, the thing i changed is

    master.sys.databases

    SELECT B.name as Database_Name, ISNULL(STR(ABS(DATEDIFF(day, GetDate(),

    MAX(Backup_finish_date)))), 'NEVER') as DaysSinceLastBackup,

    ISNULL(Convert(char(10), MAX(backup_finish_date), 101), 'NEVER') as LastBackupDate

    FROM master.sys.databases B LEFT OUTER JOIN msdb.dbo.backupset A

    ON A.database_name = B.name AND A.type = 'D' GROUP BY B.Name ORDER BY B.name;

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply