Error converting int to uniqueidentifer

bhouserbhouser Posts: 2
edited January 27, 2007 5:56AM in SQL Compare Previous Versions
When attempting to synchronize after a column has been changed from an int to a uniqueidentifier results in this error:

The following error message was returned from the SQL Server:

[206] Operand type clash: int is incompatible with uniqueidentifier

The following SQL command caused the error:

INSERT INTO [dbo].[tmp_rg_xx_Bid]([BidID], [ProjectID], [BidNumber], [ContactID], [DateSent], [DateDue], [DateReceived], [BidAmount], [Notes]) SELECT [BidID], [ProjectID], [BidNumber], [ContactID], [DateSent], [DateDue], [DateReceived], [BidAmount], [Notes] FROM [dbo].[Bid]


In this case, the primary key BidID is defined as uniqueidentifier in the source table and as int in the target table.

Any known fix or workaround other than manually deleting the target table first?

Thanks.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    This is one of those situations where SQL Server can't implicitly convert the datatype automatically, as it can from int->char or varchar->datetime (most of the time!). SQL Compare, as far as I know, doesn't have any logic for explicitly converting it (using cast or convert).

    You could probably work around this if you renamed the uniqueidentifier column so SQL Compare would not try to stuff the data from the source column into the destination column.
Sign In or Register to comment.