sql - Variable not getting set by select -
I have an issue where a variable is not set with a selection statement.
A table variable @ contact (which is used to control a loop) and then is included in the real contract and contract line tables.
My selection is:
Select Top 1 @contract_id = c.contract_id, @account = ch.account, @service = cl.service, @model = Cl.model, @serial = cl.serial, @contract = ch.contract @ Contracts c inner in contractline cl C.contract_id = cl.contract_id Internal connected contactHard cl.contract = ch.contract where cl.contract_id = @contract_id
But when I do a select @contract_id, then return me a NULL
, as all of my variables are
I Contract_ID = CLC with Contract_ID, a simple < Od> SELECT * is inserted C. CC contract = seed contract and it gives exactly 1 line with values in all the right places, there is no vacancy in the selected values.
What have I done?
It seems that your WHERE
block can be prevented from returning. You have mentioned that you have tested the same SELECT
without setting the same, but the code you listed does not include this WHERE
- so its not the same. Test your SELECT
with WHERE
and
dummy value (potential NULL
) and review. It seems like no result is not returning.
Comments
Post a Comment