Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UniqueIdentifier column can't be joined with other datatypes?

Status
Not open for further replies.

sonname

Programmer
May 18, 2001
115
US
I have a query where I am joining a uniqueidentifier column from Table A with a column in Table B. The field in Table is of datatype integer while the field in Table A is a unique identifier datatype. I know that my uniqueIdentifier is a number, but sql won't let me join on those 2 colums. It gives me the error "Operand type clash: uniqueidentifier is incompatible with int". Is there no way that you can join an uniqueIdentity field with another field that is not of the same datatype?
 
No, because you might then have a value in one that you could not possibly have in the other. Is there no way to make them the same? Perhaps if you post more details about your specific situation, I or someone else might be able to see a way around this.
 
[!]A[/!]s [!]F[/!]ar [!]A[/!]s [!]I[/!] [!]K[/!]now

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
yes Denis is right, uniqueidentifiers can be converted to varchar. i would convert both to varchar or convert the unique identifier to varchar, then convert to int. If you look up convert in BOL it shows what datatypes can be converted to what other datatypes.

Questions about posting. See faq183-874
Click here to help with Hurricane Relief
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top