Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8979

Trouble with seperating inputs

$
0
0

I am still new to the world of SQL, and I am trying to create a report with two input values, all of which can be different.

For example, I want to pull all active clients and for the first input the user would put 'all' however they must also enter in a title for clients, such as 'technology'. So the user would enter in 'all:tech' which should return ALL clients that are in Technology. However the clients should be able to enter in anything they want, with a max character length of 16 characters. Here is what I have so far, I hope this is enough for some of our stellar folks to spearhead this with me.

DECLARE

@CStauts VARCHAR(16)

DECLARE

@Title VARCHAR(16)

DECLARE

@data VARCHAR(64)

SET

@CStauts =SUBSTRING(@data,1,3)

SET

@Title ='%'+SUBSTRING(@data,1,3)+'%'

IF

@CStauts ='ALL'AND @Title=''


Viewing all articles
Browse latest Browse all 8979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>