Stored Procedure Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rajahar
    New Member
    • Mar 2008
    • 4

    Stored Procedure Problem

    Im having two databases in these two databases containing same tables and stored procedures
    In that while execting one of the stored procedures in both databases getting different records
    I want records of data which are not in another database
    Thanks in advance
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by Rajahar
    Im having two databases in these two databases containing same tables and stored procedures
    In that while execting one of the stored procedures in both databases getting different records
    I want records of data which are not in another database
    Thanks in advance
    Create a dblink to another database
    then try this query:

    [code=sql]

    SELECT * from table1 WHERE column1 NOT IN (SELECT * FROM table1@dbase2)

    [/code]

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      Use a fullname to refer to your table

      SELECT * FROM db1..table1 WHERE column1 NOT IN (SELECT * FROM db2..table1)

      -- CK

      Comment

      Working...