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 |
Andrew
Starting Member
4 Posts |
Posted - 2003-01-14 : 16:40:55
|
I don't know whether this is possible but I'm writing a simple ASP search page in which I want to have a form to type a letter in and then show all entries in a Database table where the 'title' starts with that letter. Does anyone have any idea how I could do this with SQL? |
|
SMerrill
Posting Yak Master
206 Posts |
Posted - 2003-01-14 : 16:48:53
|
This is not a Microsoft Access question.--SMerrillSeattle, WA |
 |
|
Andrew
Starting Member
4 Posts |
Posted - 2003-01-14 : 16:50:49
|
I'm using an access database... |
 |
|
SMerrill
Posting Yak Master
206 Posts |
Posted - 2003-01-14 : 16:55:02
|
So you are using Access to connect to a SQL server backend, and you are writing an ASP without using Access, (because Access writes ADP code into HTM files.) So is your ASP page using script to talk to your SQL server directly using ADO, or is it talking to an Access MDB file?Not knowing which part of the process you are having trouble with, let's start with the query.The T-SQL wildcard character is %. So you would simply take the content of the text field (on the form which contains the letter) and append a % to it. Then you could use "... WHERE Title LIKE 'V%'" where V is the letter that the user typed in.Perhaps you mean the language "SQL" as opposed to the server named SQL.Edited by - smerrill on 01/14/2003 17:11:22 |
 |
|
Andrew
Starting Member
4 Posts |
Posted - 2003-01-14 : 17:01:51
|
Hmmm, this doesn't seem to work for me... :-(Ah ha....tried LIKE 'T*' and that worked....Thanks!! :-DEdited by - Andrew on 01/14/2003 17:03:49 |
 |
|
SMerrill
Posting Yak Master
206 Posts |
Posted - 2003-01-14 : 17:08:03
|
So you must be talking to Access from your ASP. Yes, the * is the wildcard for Access, and the % is for SQL Server. I'm glad this helped you.--SMerrillSeattle, WA |
 |
|
Andrew
Starting Member
4 Posts |
Posted - 2003-01-14 : 19:17:52
|
I have found that even though * was needed in access I needed to use your idea of % in the asp code to get the required results....very odd but I'm very grateful for your assistance. |
 |
|
|
|
|