Parm nothing or something syntax

  • Thread starter Thread starter Dean Slindee
  • Start date Start date
D

Dean Slindee

Would like to have a parameter passed to a stored procedure work for both
null input or some input. This WHERE clause works in Access 2000, with an
..mdb:

WHERE (tblClient.SSN Like [Enter SSN or leave blank for all records] & "*")

Now that I have upsized to a SQL Server backend, I tried to use the code
below, but it does not work. Is the only solution to code an IF ELSE
construct, or is there a way to do this with just the WHERE clause:

ALTER PROCEDURE dbo.stpVerificationPending

@Enter_SSN_or_leave_blank_for_all varchar (12)

AS

SELECT *

FROM tblClient

WHERE tblClient.SSN LIKE @Enter_SSN_or_leave_blank_for_all +
'%'

Thanks,

Dean Slindee
 
Back
Top