|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
using like keyword with variableHi All,
i have a case in which i want to match records in table which should be start with a word, which i'm storing in a varchar varaible. How could i do this? Manish Sukhija wrote:
> Hi All, Select MyCol From dbo.MyTable Where MyCol2 Like 'MY_PREFIX%'> i have a case in which i want to match records in table which > should be start with a word, which i'm storing in a varchar varaible. > How could i do this? An index on MyCol2 will probably help. Hi
create table #test ( col varchar(100) not null ) insert into #test values ('Bill Clinton') insert into #test values ('Joe Celco') insert into #test values ('John Smith') insert into #test values ('Ron Garden') declare @var varchar(50) set @var='J' select col from #test where col like @var+'%' Show quote "Manish Sukhija" <ManishSukh***@discussions.microsoft.com> wrote in message news:01232210-9D70-43FB-9363-86EAFF0EEC5E@microsoft.com... > Hi All, > i have a case in which i want to match records in table which > should be start with a word, which i'm storing in a varchar varaible. > How could i do this? thanks Uri, it was great.
Show quote "Manish Sukhija" wrote: > Hi All, > i have a case in which i want to match records in table which > should be start with a word, which i'm storing in a varchar varaible. > How could i do this? |
|||||||||||||||||||||||