Demo for Aldonas

0

Please login or register to vote for this query.

(click on this box to dismiss)

Simple pattern matching with LIKE.

Stack Overflow

Q&A for professional and enthusiast programmers

-- Demo for Aldonas
-- Simple pattern matching with LIKE.


CREATE table #a (a_id INT PRIMARY KEY, name nvarchar(100));
INSERT INTO #a values (1, 'Copmputex S.A'),
(2, 'CityComp'),
(3, 'Netland technology'),
(4, 'Voip Service Mexico'),
(5, 'Synergy'),
(6, 'Netitlan Corp')

CREATE table #b (b_id INT PRIMARY KEY, name nvarchar(100));
INSERT INTO #b values(1, 'Synergy'),
(2, 'Netland'),
(3, 'CityComp'),
(4, 'Netitlan'),
(5, 'Copmputex'),
(6, 'VoipService')

SELECT a.name, b.name
  FROM #a a, #b b
 WHERE a.name LIKE (b.name + '%');

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results