Select queries with columns populated with Null

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yu Ong
    New Member
    • Dec 2010
    • 3

    #1

    Select queries with columns populated with Null

    Hi,

    I am trying to combine two sets of different databases, however, one of my databases does not have a particular field that the other one has, so I would like to input all the data in that field for that database as a null. I am having trouble trying to build that. As you can see OMORCT exists as a field on the AU table but does not exist in the SG table. How can I script this if I want all the fields under OMORCT in the AU table to be blank or null?

    SELECT sal.OMAS400, sal.OMPERI, sal.OMCOMP, sal.OMOREF
    FROM dbSC.dbo.tbl_SG AS sal

    UNION ALL

    SELECT sal.OMAS400, sal.OMPERI, sal.OMCOMP, sal.OMOREF, sal.OMORCT
    FROM dbSC.dbo.tbl_AU AS sal


    Thanks very much in advance for your expertise and any advice on this!!
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Null As OMORCT

    Comment

    • Yu Ong
      New Member
      • Dec 2010
      • 3

      #3
      Hi Rabbit Thanks a lot! Worked like magic! Really appreciate the expertise and help. Happy new year in advance.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        No problem and good luck with everything else. Happy New Year!

        Comment

        Working...