Vote count: 0
I have a stored procedure which contains a null comparison of
--cutting the declaration of various variables
SELECT @val = id FROM dbo.example_table
WHERE type=@type AND date=@date
if @val = null
insert record
When this is executed in the stored procedure with an empty table, this will insert the record, however when this is executed as a block of code outside the stored proc, it will not perform the insert. There are also other SQL servers on which the insert will never be made, whether inside or outside the stored proc.
Is there some explanation for why his can work in some situations but not in others? I know the correct way to perform the comparison is @val IS NULL, but i was curious to to whether @val = null was documented anywhere for completeness.
asked 50 secs ago
Inconsistency in T-SQL stored procedure with null comparison checking
Aucun commentaire:
Enregistrer un commentaire