Hi hope someone can give me some pointers on an issue I have been having with a stored procedure requirement.
I have developed a custom user control (C#/ASP.NET 3.5) which calls a stored procedure on my departments development SQL 2005 Server.
The stored procedure is proving a little difficult to workout as I am not entirely sure how I should code it up. Here is what I want to do:
1. Pass in two string values e.g "A" and "C"
2. Using those two input values, select from a table/view values that fall within the range of the two input values i.e
select values from a table/view where column 1 has values starting with "A", select values starting with "C" and select everything in between i.e anything beginning with "B" (case insensitive).
I came up with something like this but kind of stuck on how I should go about doing a range search where I am also doing a like search on some string value:
The above works fine if I only want two sets of values i.e anything beginning with "A" and anything beginning with "B".
What I would like to do is to be able to set a ranged search e.g from "A" to "Z", search within this range for anything beginning with "A", "B", "C" etc
Cheers,
Tahir
I have developed a custom user control (C#/ASP.NET 3.5) which calls a stored procedure on my departments development SQL 2005 Server.
The stored procedure is proving a little difficult to workout as I am not entirely sure how I should code it up. Here is what I want to do:
1. Pass in two string values e.g "A" and "C"
2. Using those two input values, select from a table/view values that fall within the range of the two input values i.e
select values from a table/view where column 1 has values starting with "A", select values starting with "C" and select everything in between i.e anything beginning with "B" (case insensitive).
I came up with something like this but kind of stuck on how I should go about doing a range search where I am also doing a like search on some string value:
Code:
SELECT * Column1 FROM myTable1 WHERE
Column1 like '' + @rangestart + '%' OR Column1 like '' + @rangeend + '%'
The above works fine if I only want two sets of values i.e anything beginning with "A" and anything beginning with "B".
What I would like to do is to be able to set a ranged search e.g from "A" to "Z", search within this range for anything beginning with "A", "B", "C" etc
Cheers,
Tahir