Remove Duplicated Voucher Number
SELECT VoucherNo, SourceId, COUNT(Id) AS Total FROM dbo.VoucherCtrl WHERE (Active = N'Y') GROUP BY VoucherNo, SourceId HAVING (COUNT(Id) > 1) AND (NOT (VoucherNo IS NULL)) ORDER BY SourceId, VoucherNo;
Total Record(s) Found: 3408

Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'CSng'

/RemoveDuplicatedVoucherNo-Start.asp, line 50