Querying across 2 databases

Im trying to query across 2 databases and I keep getting the below error

Conversion failed when converting the nvarchar value '1449763,1449995,1450294,1520133' to data type int.

In my query39 I have:

select * from dbo.CENLOGHISTORY where SERIALNUM = {{query40.dataArray['0'].SERIAL_NUM_MAIN}}

I've also tried:

select * from dbo.CENLOGHISTORY where SERIALNUM = {{query40.data}}

In my query 40 I have:

select SERIAL_NUM_MAIN from dbo.lock

"SERIAL_NUM_MAIN" is a "numeric" in my SQL database. I've also tried doing it under nchar(10) and I get the same failing result.

Can someone advise what i am doing wrong? Thank you

Not seeing your schema, it's a bit hard to help, but it looks like you should split the data with Javascript first, to then run the individual updates?

Do you mean split "1449763,1449995,1450294,1520133" ?

Its already split in my table like below but for some reason it converts to a nvarchar and then tries to convert to an int for the query.


Hey @rcanpolat! What kind of SQL resource are you using? It might help to take a quick look at our SQL Cheatsheet as different resource types require you to describe arrays differently within Retool.