I'm trying to run a procedure, once it finds a record in a table, in which, if you find the record, verifies that record type is another value stored in another column, if not found, save a data in a variable that is already declared.
IF Exists(SELECT *
FROM [Roga].[dbo].[RFC_Empresa_Buzon_Fiscal]
WHERE RFC = @eRFC)
SELECT TOP(1)
RTRIM(LTRIM(REPLACE(RFC, ' ', ''))) AS RFC,
RTRIM(LTRIM(Tipo)) AS Tipo,
RTRIM(LTRIM(Razon_Social)) AS Razon
FROM [Roga].[dbo].[RFC_Empresa_Buzon_Fiscal]
WHERE RTRIM(LTRIM(REPLACE(RFC, ' ', ''))) LIKE @eRFC
ELSE
SET
@eRFC = 'RFC No Valido'
This is what I wear, what I need is that the value of the "Tipo" column, is stored in a variable, which will use later to call it from C #, could guide me, I'm new to SQL Server.
Thank you
If a record exists in the table, run a procedure
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Saineshwar BageriRank #115 · 19.6K reputationPosted Oct 10, 2014, 7:28 PM EDT
Just call stored proc like this Exec "your store procedure" where ever you want and if you have parameter to pass then.
exec "your store procedure" "a" , "b" your parameters.