Re: Return or Select Partial String value

From: scmiles (anonymous_at_discussions.microsoft.com)
Date: 05/13/04


Date: Thu, 13 May 2004 09:42:42 -0700

Thank you, this works just fine.

>-----Original Message-----
>CREATE TABLE #Temp_First
>(
> Num VARCHAR(20)
>)
>
>CREATE TABLE #Temp_Second
>(
> Num VARCHAR(40),
> Des VARCHAR(40)
>)
>
>INSERT INTO #Temp_First VALUES ('11111')
>INSERT INTO #Temp_First VALUES ('44444')
>INSERT INTO #Temp_First VALUES ('55555')
>
>INSERT INTO #Temp_Second VALUES
('www.domain.com/11111','comment1')
>INSERT INTO #Temp_Second VALUES
('www.domain.com/44444','comment2')
>INSERT INTO #Temp_Second VALUES
('www.domain.com/55555','comment3')
>
>SELECT * FROM
> #Temp_First
> JOIN #Temp_Second
> ON #Temp_Second.num LIKE '%' + #Temp_First.num
>
>---
>Rohtash Kapoor
>http://www.sqlmantra.com
>
>
>"scmiles" <anonymous@discussions.microsoft.com> wrote in
message
>news:cb3001c438f8$ca6ecb40$a301280a@phx.gbl...
>> I need a SELECT query that can compare/match a string
>> value, example, tableX.number = '12345' from tableX, to
>> tableY.URL = 'http://www.domain.com/folder/name-12345'
>>
>> so the WHERE clause can match the two by the full value
>> of tableX.number to the partial value at the end of
>> tableY.URL
>>
>> Any help appreciated
>> Thanks
>
>
>.
>



Relevant Pages

  • Re: 2 extreme newbie ?s
    ... > completely oblivious as to which libraries to look in. ... > Dim num As Double ... > If I want num to be set to 8.93, which method of the String class should I ... > clause to function the way I want it to. ...
    (microsoft.public.dotnet.academic)
  • HELP! Selecting Array Rows based on an array of field=>value s
    ... foreach($retvi as $num => $row){ ... //DONE LIMITING TO WHERE CLAUSE ... return $retvi; ...
    (comp.lang.php)
  • VB Question
    ... I am wondering if it is possible to change the WHERE clause of this statement ... Lets say on a search form a user searchs for a record, ... INSERT INTO SRMisc ([Tracker Item], Description, Comments, Requestor, [SR ... Num]) ...
    (microsoft.public.access.forms)
  • Re: DBI/SQL question
    ... statement using a "like" clause. ... foreach my $num { ... like # I draw a blank here ... I am not sure how to use the $num in a like since a like is '%' and it I do '%$num' that won't be ierpolated. ...
    (perl.beginners)
  • DBI/SQL question
    ... I have a large array of numbers that I need to use in an update SQL statement using a "like" clause. ... foreach my $num { ... equip like # I draw a blank here ... I am not sure how to use the $num in a like since a like is '%' and it I do '%$num' that won't be interpolated. ...
    (perl.beginners)