Comparing procedures on different servers

  • From reading BOL on the FROM statement it says that it should be

    linked_server.catalog.schema.object

    However, I can't get this to work (I'm running from server named Rabbit)

    select name, type from sys.procedures

    where name not in (select name FIVER.AHOG.dbo.sys.procedures)

    order by name

    I want to compare to the list of procedures on

    Server: FIVER

    DB:AHOG

    It gives an error: Incorrect syntax near '.'

    What am I missing?

  • The naming convention of SQL Server is a four part name.

    Try this naming convention

    You should not have DBO in that name

    -Roy

  • select name, type from sys.procedures

    where name not in (select name from FIVER.AHOG.dbo.sys.procedures)

    order by name

    'from' is missing in the sub-query in WHERE clause..

  • two things i think, but i could't get mine to work yet either.

    4 part naming conventions are the limit.

    select name FIVER.AHOG.dbo.sys.procedures is wrong

    its probably FIVER.AHOG.sys.procedures not what you had....i tried something similar on mine and could not get to it. I was able to get to select * from FIVER.AHOG.dbo.sysobjects, just not to the sys.* views.

    maybe you can just change that piece?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Yeah I did forget the from.

    select name, type from sys.procedures

    where name not in (select name FROM FIVER.AHOG.sys.procedures)

    order by name

    How do I link the servers so I can use the NTLogin for both in this type of action?

  • Instead of sys.objects, why not try

    SELECT *

    FROM INFORMATION_SCHEMA.ROUTINES

    WHERE SPECIFIC_SCHEMA = N'dbo'

    -Roy

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

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