Use of contains in sql server

0 votes

I need a table name. Product has 3 columns, including:

Product-id
name
Price

In the name column, all product names are present. For example: 1340 GPS, 1340T GPS etc.

When I write

select top 10 * from product where contains(name,'1340');

Result 1 row 1340 GPS

But when I search

select top 10 * from product where name like '%1340%';

Then the result is 1340 GPS and 1340T GPS.

Actually, I need it to display both rows like the LIKE operator when I use contains().

How do I do it?

Sep 8, 2022 in Database by Kithuzzz
• 38,010 points
740 views

1 answer to this question.

0 votes

The straightforward method is shown here. You can use the operator "*" before in the contain syntax. but you need to use double quotes before and after the search string. Check the following:

SELECT *
FROM product
WHERE CONTAINS(name,'"*1340*"');

I hope this helps you.

answered Sep 10, 2022 by narikkadan
• 63,720 points

Related Questions In Database

0 votes
1 answer

How Can I use "Date" Datatype in sql server?

There's problem in all of them and ...READ MORE

answered Feb 9, 2022 in Database by Neha
• 9,060 points
1,164 views
0 votes
1 answer

Syntax of for-loop in SQL Server

TSQL has no for-loop, we have only ...READ MORE

answered Feb 15, 2022 in Database by Neha
• 9,060 points
793 views
0 votes
0 answers

Execution sequence of Group By, Having and Where clause in SQL Server?

I'm just not sure how a SQL ...READ MORE

Aug 19, 2022 in Database by Kithuzzz
• 38,010 points
464 views
0 votes
1 answer

Calculate Time Intersection to Correlate Sequences of Independent Events

I think this solution requires a CROSS JOIN implementation. ...READ MORE

answered Oct 26, 2018 in Power BI by Upasana
• 8,620 points
656 views
0 votes
1 answer

What are the different authentication modes in SQL Server? How can it be changed?

Windows mode and Mixed Mode – SQL ...READ MORE

answered Oct 29, 2018 in Database by Sahiti
• 6,370 points
1,088 views
0 votes
1 answer

Time Series Chart in Power BI

Your Date format should be handled by ...READ MORE

answered Nov 26, 2018 in Power BI by Upasana
• 8,620 points
4,296 views
0 votes
1 answer

Power BI Using SQL Server stored procedures

NOTE: The following works for the "Import ...READ MORE

answered Dec 14, 2018 in Power BI by Upasana
• 8,620 points
6,102 views
0 votes
1 answer

What is the use of a cursor in SQL Server?

Instead of receiving a result set as ...READ MORE

answered Sep 13, 2022 in Database by narikkadan
• 63,720 points
560 views
0 votes
1 answer

What is the equivalent of 'describe table' in SQL Server?

Use the sp_columns stored procedure: exec sp_columns MyTable I hope this ...READ MORE

answered Sep 17, 2022 in Database by narikkadan
• 63,720 points
659 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP