March 7, 2011

Search details on any parameters in SQL Server

Search details on any field MobileNo,CTID,TNo,EMailId

SELECT ID,CTID,CustomerName,MobileNo,TicketNo,[Status] FROM VIDComplaintDetails,StatusMaster

WHERE
( @MOBILENO IS NULL OR MobileNo = @MOBILENO)
AND ( @CTID IS NULL OR CTID = @CTID)
AND ( @TNO IS NULL OR TicketNo = @TNO)
AND ( @EMAILID IS NULL OR EmailID = @EMAILID)
AND
VIDComplaintDetails.ComplaintStatus = StatusMaster.StatusID

No comments:

Post a Comment