I tried and got the solution in the below manner but I am looking if there is any other approach for this:
Declare @count int , @count1 int
SELECT @count = (SELECT count(gv.number) frst
FROM tbl As gv
INNER JOIN #voucherno ro ON ro.VoucherNo = gv.number
WHERE gvs.numStatus = 'Active at HO'
)
SELECT @count1 = (select COUNT(v.voucherno) scnd from #voucherno v)
IF @count = @count1
print 'correct'
ELSE
Print 'Invalid series'
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/