July 8, 2022 at 4:18 pm
Hello Community,
I'm getting the following SQL error in Azure Synapse
Error converting data type varchar to bigint.
;WITH CTE1 AS
(
SELECT *,ROW_NUMBER()OVER(ORDER BY ts_primarysecondaryfocus)RowNum FROM [dbo].[account]
),CTE2 AS
(
SELECT *,ROW_NUMBER()OVER(ORDER BY ts_primarysecondaryfocus)RowNum FROM [dbo].[OptionsetMetadata]
)
SELECT C1.Id,C1.SinkCreatedOn,C1.SinkModifiedOn,C1.statecode,C1.statuscode
,CASE WHEN C1.ts_primarysecondaryfocus<>ISNULL(C2.ts_primarysecondaryfocus,'')THEN C2.ts_primarysecondaryfocus ELSE C1.ts_primarysecondaryfocus END AS ts_primarysecondaryfocus
,C1.customertypecode,C1.address1_addresstypecode,C1.accountclassificationcode,C1.ts_easeofworking
,CASE WHEN C1.ts_ukrow<>ISNULL(C2.ts_ukrow,'')THEN C2.ts_ukrow ELSE C1.ts_ukrow END AS ts_ukrow
,C1.preferredappointmenttimecode,C1.xpd_relationshipstatus,C1.ts_relationship
FROM CTE1 C1 LEFT JOIN CTE2 C2 ON C1.RowNum = C2.RowNum
The problem is, I don't know why Azure Synapse is trying to convert the Data Type to BIGINT.
Also, I don't know how to change the field to BIGINT in Azure Synapse.
I have posted this here because Azure Synapse SQL language is T-SQL
Any thoughts?
July 9, 2022 at 5:10 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
July 10, 2022 at 8:40 am
As a 1st guess, I would think that either C2.ts_primarysecondaryfocus or C2.ts_ukrow has a BIGINT data type.
If that is not the case, then start by commenting all of the fields out in the main SELECT, and add them back 1 at a time, until you find which one is causing the issue.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply