Hi,
I want to add a default value to a stored procedure parameter (datatype int), that when executing the stored procedure will grab all rows if that parameter is not passed a value to it.
If possible, I don't want to add logic, i.e. If @PassID = NULL, etc.
Is there a way to use a wildcard?
Do I have to CAST it first?
Example
I want to add a default value to a stored procedure parameter (datatype int), that when executing the stored procedure will grab all rows if that parameter is not passed a value to it.
If possible, I don't want to add logic, i.e. If @PassID = NULL, etc.
Is there a way to use a wildcard?
Do I have to CAST it first?
Example
Code:
GO
ALTER PROCEDURE [dbo].[myprocname]
-- Add the parameters for the stored procedure here
@PassedID int = '> 0'
AS
BEGIN
SELECT *
FROM TABLE1
WHERE TABLE1.ThisID = @PassedID