Wednesday, 3 July 2013

String Id Comma Separate Find Query logic

String Id Comma separate Query logic

For example : ProductCategoryId has "1,5,7,9,11,16" multiple id
                       Find/Search 5 in  ProductCategoryId ?

Query :

And charIndex(',' + rtrim(cast(IsNull(Items.ProductCategoryId,0) as nvarchar(max))) + ',',',' + isnull(@ProductCategoryId,IsNull(Items.ProductCategoryId,0)) +',') >0

No comments:

Post a Comment