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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Select statement with wide card *

Author  Topic 

ChrisRobert
Starting Member

2 Posts

Posted - 2002-03-03 : 06:29:27
Hi everyone,

Can someone help me out on this problem?

I have a table with the following fields:

CompanyName, Date, SalesPersonID

The company name is ranging from A to ZZZZZZZ.

So when i type A* in Text1.text the return value should be all the company starting with the name A. If i type only AA then only company name AA should shows up. If AA* then all company name with AA should show up.

SELECT * From Table1 Where Table1.CompanyName = ' & Text1.Text & '

Please help.

Thanks

Regards
Chris

Nazim
A custom title

1408 Posts

Posted - 2002-03-03 : 07:17:51
Sql server has a different set of wild card characters
% is for multiple characters( like *)
_ for single character(like ?)

Therefore, Replace * with % and ? with _ in your search criteria.

instead of using = use like operator when you want wild card search to take place.

eg:
SELECT * From Table1 Where CompanyName like ' & Text1.Text & '
HTH

--------------------------------------------------------------


Edited by - Nazim on 03/03/2002 07:20:52
Go to Top of Page

ChrisRobert
Starting Member

2 Posts

Posted - 2002-03-03 : 13:11:32
quote:

Hi everyone,

Can someone help me out on this problem?

I have a table with the following fields:

CompanyName, Date, SalesPersonID

The company name is ranging from A to ZZZZZZZ.

So when i type A* in Text1.text the return value should be all the company starting with the name A. If i type only AA then only company name AA should shows up. If AA* then all company name with AA should show up.

SELECT * From Table1 Where Table1.CompanyName = ' & Text1.Text & '

Please help.

Thanks

Regards
Chris





Thanks man you are of great help!!!!!

Go to Top of Page
   

- Advertisement -