SQL 2000 or 2005 how to tell remotely

  • HI

    I am trying to run a use a central reporting SQL server to monitor the size of the databases on all the other servers.

    I was going to run a cursor on sys.servers to go get the data from all the other instances.

    Unfortunately we have a mixed environment with 2000 and 2005 server.

    for the former i need to look in sysdatabases, sysaltfiles and in the latter sys.databases and wherever!

    What would be good would be to check the server for the type of install and then run the appropriate query/sp.

    Can't figure how though!

    Tried using error handling on the query without any joy. Query just abort when it can't find the right table. Probably doing this wrong too.

    Any suggestions?

    g

  • run "SELECT @@VERSION" on the server and it will show you which version it is running.

    If you want to retrieve additional information, you can query using SERVERPROPERTY. for example:

    SELECT

    SERVERPROPERTY ('productversion'),

    SERVERPROPERTY ('productlevel'),

    SERVERPROPERTY ('edition')

    .

  • Thanks Jacob

    That returns the version of the server on which you are running the query - i need to learn the version of the linked server so that i can select the correct query to run there.

    cheers for speedy answer though.

    G

  • You can use OPENQUERY() to execute it on the linked server. for example:

    SELECT Version FROM OPENQUERY ( myserver, 'SELECT @@version AS Version' )

    .

  • Hey Jacob

    That's brilliant - just what I needed.

    Never seen OPENQUERY before, never needed it. Now it's in the toolbox.

    Many thanks

    Greggo

  • Glad to hear that it helped

    .

Viewing 6 posts - 1 through 5 (of 5 total)

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