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 |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2002-10-22 : 02:07:55
|
| I wondering if I can get a little help here, Im unsure the best way to go about it. What I have to change is the following.I have to pass a parameter to the procedure (a-z) and it brings back all records where tbluserdetails.nameonline start with the first letter passed. The other half of this is I need to figure out how to pass another parameter that brings back all records that DONT start with any letter (a-z)Any help greatly appreciated, thanks alot!!mike123CREATE PROCEDURE select_online_members AS SET NOCOUNT ONSELECT uq_users.sess, uq_users.userID, tblUserDetails.nameOnline FROM (SELECT userID, min(sessionID) AS sess FROM tblactive_users WHERE userID > '0' GROUP BY userID) AS uq_users INNER JOIN tblactive_users AS info ON uq_users.sess = info.sessionID AND uq_users.userID = info.userID JOIN tblUserDetails on tblUserDetails.userID = uq_users.userID ORDER BY sessionID DESCGO |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-10-22 : 02:48:32
|
| HiThis won't be particularly quick (i.e. no indexes) but you can look at the ASCII value of the first character.Something likeWHERE Ascii(substring(nameonline, 1, 1)) NOT BETWEEN 65 AND 122How is that for you ?Damian |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-10-22 : 02:50:19
|
| Ooops I should read the question first.For the first bit you can use :WHERE nameonline like @Letter + '%'Damian |
 |
|
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2002-10-24 : 17:09:29
|
| worked like a charm, thanks |
 |
|
|
|
|
|