2
I need to return the idCity. If it is not found in one table, it is obligatory in the other. The return is nil.
My Query
public const string sql = @"DECLARE @retorno AS INT = 0;
SELECT @retorno = id
FROM tabCidade1
WHERE nomeCidade = 'Curitiba'
SELECT @retorno = id
FROM tabCidade2
WHERE nomeCidade = 'Curitiba'
SELECT @retorno;";
Code no c#
using (var connection = My.ConnectionFactory())
{
connection.Open();
int idCidade = connection.Query<int>(sql);
}
Couldn’t be something simpler, like TOP 1 + UNION, OR UNION ALL?
– Bacco
What’s the matter?
– Jean Gustavo Prates