Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    SQL Union Question

    This code worked perfectly fine in Access but when i run it from SQL i get the error?

    Microsoft OLE DB Provider for SQL Server error '80040e14'

    The text, ntext, or image data type cannot be selected as DISTINCT.


    Code:
    SELECT UName_E AS Term_e, UAbbr_E AS Desc_e, 1 AS TableName FROM UnitNames Union SELECT ProductName AS Term_e, ProductDesc AS Desc_e, 2 AS TableName FROM Equip_ProductName

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    Are the columns you select from the two tables of the same datatype? I remember SQL had a problem doing a union when the datatypes of the columns don't match
    I am the luckiest man in the world

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try using UNION ALL


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •