I have the following query, can you please suggest me what is wrong with this, its never entering inside the IF block, even though data is present in a table.
DECLARE @AccountNumber NVARCHAR(50) ='54654654'
IF Exists( Select TOP 1 1 FROM [dbo].[CheckRecords] where DetailRecord like '% ' + @AccountNumber +' %')
BEGIN
Print 'Hello' + @AccountNumber
END
DECLARE @AccountNumber NVARCHAR(50) ='% 54654654 %'top 1though becauseexistsdoesn't require a single record.