stored procedures - Simple SQL Query Help -


I am creating a query for a search in MS SQL 05

I have 4 Select the things that the user can make, and I want to use it on and logic.

But I can not seem to get it working when NULL is being passed.

I have this: [Sp_FindSource] - Add the parameter here to the stored procedure @ code varchar (500), @seed varchar (50), @ serial no varchar (50), @ square decimals ( 10,5) Select from the beginning * tblSource in the WHERE code (SELECT value with funcListToTableInt (@Code, ',')) and '%' + @ssID + '%' like SSID and not serial '%' + @serialNo + '%' and category = @ class end

Note: the funcListToTableInt function passes paragraph passed paragraph values ​​(it works by itself, if I have other Tetment removes I)

I are looking for something above does not return, if I passed in black and I only ask a few of them, so I ignore how the values? Yuggh, this is killing me.

You have to wrap something or have the ultimate where your checks:

  Optional Process [dbo]. [Sp_FindSource] - Select the parameter for the stored procedure here. Add the code @ varchar (500), @ century varchar (50), @ serial no varchar (50), @ decimal decimal (10,5) * From tblSource (where in the value (choose from the value is funcListToTableInt (@Code, ',') or @ code) and (SiteSourceID is preferred '%' + @ SIDID + '%' or @ SID tap) and ( Serial '%' + @ serial no ''% '' or 'serial is not any tap) and (category = @ category OR @ range is tap) end   

this first look Very much in Children think, because it is being investigated by the parameters of the IS NULL, but it works.

Comments