RE: Conditional WHERE
Here's an alternative: IF EXISTS ( SELECT * FROM Clients C INNER JOIN InvoiceHeader I ON I.ClientID=C.ClientID INNER JOIN Addresses A ON A.ClientID=C.ClientID WHERE I.InvoiceNr=@InvoiceNr AND A.PrimaryAddr=1 ) BEGIN SELECT COALESCE(LTRIM(COALESCE(Salutation,'') + ' ' + FName + ' ' + LName), BusinessName) AS ClientName, A.* FROM Clients C INNER JOIN InvoiceHeader I ON I.ClientID=C.ClientID INNER […]
2003-06-17
1 reads