Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Desmag
Starting Member
18 Posts |
Posted - 2005-12-14 : 18:48:26
|
| Hi guysI'm trying to find a simple way to select values from a Varchar column that start with any digit.Is there way of doing it other than repeating: A_Column LIKE '1%' OR A_Column LIKE '2%' OR A_Column LIKE '3%' OR etc...Thanks in advance |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-12-14 : 18:56:19
|
| SELECT * FROM myTable WHERE A_Column LIKE '[0-9]%' |
 |
|
|
Desmag
Starting Member
18 Posts |
Posted - 2005-12-14 : 19:32:35
|
| MAGIC!!Thanks very much. |
 |
|
|
Desmag
Starting Member
18 Posts |
Posted - 2005-12-16 : 17:40:52
|
| I have another, similar question.Is there a way of passing a parameter to a stored procedure, which will choose either certain one number, or, all the numbers from the Integer column?I'm writing a procedure, which will pick products in one category or all of the products on all categories.Is it possible with just one parameter or do I have to go a dynamic SQL route? |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-12-19 : 06:12:11
|
| where (productcode = @productparam or @productparam is null) |
 |
|
|
|
|
|