locked
Tsql RRS feed

  • Question

  • i m having two databases and in the first data base i m having a table village_master in the second database also i m having a table village master now i m trying to display the villages that are present in the first database but not in the second database and villages that are present inthe second database but not in the first database, but i m not getting it , the query is as follows:

      

    select

     

    Lstock.dbo.village_master

    except

    select

     

    Lstockhh.dbo.village_master

    the error are as follows:

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "Lstock.dbo.village_master" could not be bound.

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "Lstockhh.dbo.village_master" could not be bound.

    if any one can sort the problem please.

    Friday, November 26, 2010 5:16 AM

Answers

  • Your syntax should be something like...

    select *
    From Lstock.dbo.village_master
    except
    select *
    From Lstockhh.dbo.village_master
    

    ...note you should specify the exact columns you want to return and replace the *. For more details have a look at...

    http://msdn.microsoft.com/en-us/library/ms188055.aspx

     

    Thanks

     

     


    /Neil Moorthy - Senior SQL Server DBA/Developer (MCITP (2005), MCAD, OCA 11g) Please click the Mark as Answer button if a post solves your problem
    Friday, November 26, 2010 5:27 AM