PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Query LIKE operator
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Query LIKE operator
![]() |
Query LIKE operator |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I thought that the LIKE operator would return a partial value search. Suppose
you want a client name Smith and you enter a partial value of Smi, should that locate it? Here is my query code. This code works as long as you type the entire name. SELECT [CODE], [Stable], [HorseName], [NickName], [Active], [MainWork], [LastDate], [Weeks], [DueDate], [LastCost], [Totals], [AngleLF], [AngleRF], [AngleLH], [AngleRH], [LengthLF], [LengthRF], [LengthLH], [LengthRH], [SizeLF], [SizeRF], [SizeLH], [SizeRH], [StartAngleLF], [StartAngleRF], [StartAngleLH], [StartAngleRH], [StartLengthLF], [StartLengthRF], [StartLengthLH], [StartLengthRH], [NeedsNewFr], [NeedsNewHd], [Front], [Hind], [Delete], [AngleList], [LengthList] FROM [Horse] WHERE HorseName LIKE (@HName) Thanks Jon Stroh |
|
|
|
#2 |
|
Guest
Posts: n/a
|
This probably isn't the correct group to post this question; you may want to
look at a group like the sqlserver.programming group. However, I think what you need is to put a "%" at the end of the search string. The end of the query would read: set @HName = @HName + '%' .... where HorseName like (@HName) HTH David "Jon" <Jon@discussions.microsoft.com> wrote in message news:FE20713D-286E-4241-BCDE-ECF7702C6E73@microsoft.com... >I thought that the LIKE operator would return a partial value search. >Suppose > you want a client name Smith and you enter a partial value of Smi, should > that locate it? > > Here is my query code. This code works as long as you type the entire > name. > > SELECT [CODE], [Stable], [HorseName], [NickName], [Active], [MainWork], > [LastDate], [Weeks], [DueDate], [LastCost], [Totals], [AngleLF], > [AngleRF], > [AngleLH], [AngleRH], [LengthLF], [LengthRF], [LengthLH], [LengthRH], > [SizeLF], [SizeRF], [SizeLH], [SizeRH], [StartAngleLF], [StartAngleRF], > [StartAngleLH], [StartAngleRH], [StartLengthLF], [StartLengthRF], > [StartLengthLH], [StartLengthRH], [NeedsNewFr], [NeedsNewHd], [Front], > [Hind], [Delete], [AngleList], [LengthList] FROM [Horse] > WHERE HorseName LIKE (@HName) > > Thanks Jon Stroh |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

