Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there any other way for this procedure?
    primarykey
    data
    text
    <p>I have 7 fields in a table; possible combinations of fields generate some result. A combination can be 1 or 4 or 7 or all and so on, which can be changed dynamically as given by client. I have to create a procedure for it. These fields are BIT type. Is there any other way to create these procedures except defining for each case by If Else...If Else? </p> <pre><code>@Chk_title AS BIT , @Chk_Description AS Bit , @Chk_Keywords AS BIT, @Chk_Category AS BIT, @Chk_Location AS BIT, @Chk_Source AS BIT, @Chk_Date AS BIT, @RD_btn_AND_OR AS BIT AS if @RD_btn_AND_OR = 1 Begin if @Chk_title = 1 AND @Chk_Description=1 AND @Chk_Keywords=1 @Chk_Category=1 @ Location=1 @ Chk_Source=1 @Chk_Date=1 Begin Select title, Description, Keywords, category, Location, source, Date from server_des where title Like '%'+@title+'%' AND Description Like '%'+@Description+'%' AND Keywords Like '%'+@Keywords+'%' AND category Like '%'+@Category+'%' AND Location Like '%'+@Location+'%'AND source Like '%'+@Source+'%' AND Date Like '%'+@Date+'%' End ELSE if @Chk_title = 1 AND @Chk_Description = 1 AND @Chk_Keywords = 0 @Chk_Category=1 @ Location=1 @ Chk_Source=1 @Chk_Date=0 Begin Select title, Description, null as'Keywords', category, Location, source, Date from server_des where title Like '%'+@title+'%' AND Description Like '%'+@Description+'%' AND category Like '%'+@Category+'%' AND Location Like '%'+@Location+'%' AND source Like '%'+@Source+'%' AND Date Like '%'+@Date+'%' End ELSE if @Chk_title=0 AND @Chk_Description=1 AND @Chk_Keywords=1 @Chk_Category=1 @ Location=1 @ Chk_Source=0 @Chk_Date=1 Begin Select null as'Title', Description, Keywords, category, Location, source, Date from server_des where Description Like '%'+@Description+'%' AND Keywords Like '%'+@Keywords+'%' AND category Like '%'@Category'%' AND Location Like '%'+@Location+'%' AND source Like '%'+@Source+'%' AND Date Like '%'+@Date+'%' End END </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload