multiple condition in store procedure sql server -


I need display data on the grid with the store process in two situations.

First, select if the filter is zero or empty = result 'from the partition where idle = 1'

and if the filter is not zero. I want to select from division * where the code ...

and this is my query. What is wrong? Please help in deciding ...

  announcement @philter varchar (100) DECLARE @ SQL varchar (4000) SET @sQL = 'SELECT * SET @sql = @sql +' from the division '%' + @ Filter + '%' like the 'if' filter @ is zero or @ filter = 'sittel = sql = @ sql +' iactive = 1 'and elast seel = ssll +' code '  

I will help this by query below

DECLARE @ code varchar (10) --- Input parameter

DECLARE @IdFilter int = 0

  If ISNULL (@code, '') = '' SET @ Choose IdFilter = 1 WHERE The division is WHERE (@IdFilter = 1 or '%' + 0x + '%' as the code) and ISActive = 1    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -