sql server - how to get all rows using a specific value in parameter -
are there way rows in clause if parameter have specific value
example if boltpattern = should return
| boltpattern | ----------------- | 5x117 | | 5x117 | | 5x120 | | 5x125 |
else if boltpattern = 5x117 should return
| boltpattern | ----------------- | 5x117 | | 5x117 |
my storedprocedure
alter procedure [data].[usp_filterdata] @boltpattern nvarchar(1000)=null, set nocount on select p.[boltpattern] [data].[wheeldata] p @boltpattern null or p.[boltpattern]=@boltpattern
if want extract records when @boltpattern null can use:
where @boltpattern null or boltpattern=@boltpattern , @boltpattern not null
if want extract records when @boltpattern ='all' can use:
where @boltpattern ='all' or boltpattern=@boltpattern , @boltpattern <>'all'
Comments
Post a Comment