<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>contains &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/contains/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Wed, 28 Feb 2018 02:16:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server: Create Full Text Search Index, Use CONTAINS for pattern matching</title>
		<link>https://www.dbrnd.com/2018/03/sql-server-create-full-text-search-index-use-contains-for-pattern-matching/</link>
					<comments>https://www.dbrnd.com/2018/03/sql-server-create-full-text-search-index-use-contains-for-pattern-matching/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 03 Mar 2018 16:16:26 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[contains]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Full Text Search]]></category>
		<category><![CDATA[Pattern Matching]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7176</guid>

					<description><![CDATA[In this post, I am sharing the use of CONTAINS for matching the patterns in SQL Server. We know about the LIKE predicate which we are using for a specific type of pattern matching. SQL Server Full-Text Search Index stores the different patterns of the defined column. We can employ CONTAINS on the column of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&#038;title=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" data-a2a-url="https://www.dbrnd.com/2018/03/sql-server-create-full-text-search-index-use-contains-for-pattern-matching/" data-a2a-title="SQL Server: Create Full Text Search Index, Use CONTAINS for pattern matching"></a></p><p>In this post, I am sharing the use of CONTAINS for matching the patterns in SQL Server. </p>
<p>We know about the LIKE predicate which we are using for a specific type of pattern matching. SQL Server Full-Text Search Index stores the different patterns of the defined column. </p>
<p>We can employ CONTAINS on the column of Full-Text Search and can search different patterns. </p>
<p><strong>Please check the below demonstrations:</strong></p>
<p><strong>Create a table with sample records:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employee (empid int not null, ename varchar(20) not null, salary int)
GO

INSERT INTO tbl_Employee VALUES 
(1,'abc',25000),(2,'xyz',30000),(3,'svq',40000)
,(4,'cvq',26000),(5,'rfq',70000),(6,'opq',45000)
GO</pre> </p>
<p><strong>Create a Full Text Search Index:</strong></p>
<pre class="crayon-plain-tag">CREATE UNIQUE INDEX uk_empid ON tbl_Employee(empid);
  
CREATE FULLTEXT CATALOG ft AS DEFAULT; 

CREATE FULLTEXT INDEX ON tbl_Employee(ename)   
   KEY INDEX uk_empid   
   WITH STOPLIST = SYSTEM;</pre> </p>
<p><strong>Use CONTAINS, for performing FULL Text Search:</strong><br />
Check the below sample use of CONTAINS, If you want to use the same thing using LIKE then we have to write LIKE separately for each pattern. </p>
<pre class="crayon-plain-tag">SELECT *FROM [dbo].[tbl_Employee]
WHERE CONTAINS(ename, '"a*" OR "s*" OR "cv*"')</pre> </p>
<p><strong>Result:</strong></p>
<pre class="crayon-plain-tag">empid       ename                salary
----------- -------------------- -----------
1           abc                  25000
3           svq                  40000
4           cvq                  26000</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/03/sql-server-create-full-text-search-index-use-contains-for-pattern-matching/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Database Developer (T-SQL) Interview Questions and Answers (Day-15)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 26 Jun 2016 19:58:39 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[contains]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Database Developer]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[freetext]]></category>
		<category><![CDATA[Full text searching]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[Universally Unique Identifier]]></category>
		<category><![CDATA[UUID Data type]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3082</guid>

					<description><![CDATA[What do you know about the Universally Unique Identifier &#8211; UUID data type? Database Theory: The truth about Universally Unique Identifier &#8211; UUID When we are declaring a variable using SET or SELECT, What is the performance different between SET and SELECT? SQL Server: Truth about assigning variables using SET versus SELECT What is the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&amp;linkname=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15%2F&#038;title=SQL%20Server%3A%20Database%20Developer%20%28T-SQL%29%20Interview%20Questions%20and%20Answers%20%28Day-15%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-developer-t-sql-interview-questions-and-answers-uuid-data-type-encryption-full-text-search-day-15/" data-a2a-title="SQL Server: Database Developer (T-SQL) Interview Questions and Answers (Day-15)"></a></p><p><strong>What do you know about the Universally Unique Identifier &#8211; UUID data type?</strong></p>
<blockquote class="wp-embedded-content" data-secret="SEzTGAfIgs"><p><a href="https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/">Database Theory: The truth about Universally Unique Identifier &#8211; UUID</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/database-theory-the-truth-about-universally-unique-identifier-uuid/embed/#?secret=SEzTGAfIgs" data-secret="SEzTGAfIgs" width="600" height="338" title="&#8220;Database Theory: The truth about Universally Unique Identifier &#8211; UUID&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>When we are declaring a variable using SET or SELECT, What is the performance different between SET and SELECT?</strong></p>
<blockquote class="wp-embedded-content" data-secret="LWlmYmIfBE"><p><a href="https://www.dbrnd.com/2016/03/sql-server-truth-about-assigning-variables-using-set-versus-select/">SQL Server: Truth about assigning variables using SET versus SELECT</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/sql-server-truth-about-assigning-variables-using-set-versus-select/embed/#?secret=LWlmYmIfBE" data-secret="LWlmYmIfBE" width="600" height="338" title="&#8220;SQL Server: Truth about assigning variables using SET versus SELECT&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is the purpose of OPENXML clause SQL server stored procedure?</strong></p>
<blockquote><p>OPENXML parses the XML data in SQL Server in an efficient manner. It’s primary ability is to insert XML data to the RDB. It is also possible to query the data by using OpenXML. The path of the XML element needs to be specified by using ‘xpath’.</p></blockquote>
<p><strong>What is the use of @@CPU_BUSY statement?</strong></p>
<blockquote><p>It returns the time that SQL Server has spent working since it was last started.</p></blockquote>
<p><strong>Explain the use of keyword WITH ENCRYPTION. Create a Store Procedure with Encryption.</strong></p>
<blockquote><p>WITH ENCRYPTION indicates that SQL Server will convert the original text of CREATE PROCEDURE statement to an encrypted format. Users that do not have no access to system tables or database files cannot retrieve the encrypted text. However, the text will be available to privileged users.</p></blockquote>
<p><strong>If you need to script a table with data, how will you do that?</strong></p>
<blockquote><p>One way to achieve this by using  Generate Script Task in SSMS.</p>
<p>Right click on database and then go to Tasks and then go to Generate Scripts.</p></blockquote>
<p><strong>I have two tables with the same columns and data types. If I need toget distinct records from both of tables how can I do that?</strong></p>
<blockquote><p>We can use the UNION operators.</p></blockquote>
<p><strong>Can we send emails in HTML Format from SQL Server, How will you do that?</strong></p>
<blockquote><p>We can send email from SQL Server in HTML format by using dbo.sp_send_dbmail stored procedure. To send email in HTML format, we have to build the body of email with HTML Tags. The below code can be used to send basis HTML formatted email. If you want to loop through some results of table and send in HTML formatted email.</p></blockquote>
<p><strong>Can we create triggers on temp table?</strong></p>
<blockquote><p>No: we cannot create a trigger on temp table.</p></blockquote>
<p><strong>How would you get the size of a SQL Server Table?</strong></p>
<blockquote><p>EXEC sp_spaceused &#8216;TableName&#8217;</p></blockquote>
<p><strong>How would you determine if the expression is Numeric?</strong></p>
<blockquote><p><strong>ISNUMERIC( ):</strong> function is provided to us in SQL Server to check if the expression is valid numeric type or not. As per Microsoft it should work with Integers and Decimal data types and if data is valid integer or decimal, ISNumeric() should return us 1 else 0.</p>
<p><strong>Try_Convert( ):</strong> In SQL Server 2012. Microsoft introduced new function call Try_Convert( ). You can use try_convert function to convert to required data type and if it is not able to convert then it will return Null as output.</p></blockquote>
<p><strong>Which function is used to convert the integer value into spaces?</strong></p>
<blockquote><p>The SPACE function converts the specified integer value into spaces.</p><pre class="crayon-plain-tag">SELECT SPACE(8);</pre><p>
</p></blockquote>
<p><strong>What is constant folding?</strong></p>
<p><strong>SQL Server evaluates some constant expression early to improve the query performance. This is called constant folding.</strong></p>
<p><strong>What is a full text search in SQL Server?</strong></p>
<blockquote><p>Full text indexing is a great feature that solves a database problem, the searching of textual data columns for specific words and phrases in SQL Server databases.</p>
<p>Full Text Index can be used to search words, phrases and multiple forms of a word or phrase using FREETEXT () and CANTAINS () with “and” or “or” operators.</p></blockquote>
<p><strong>Can you execute full-text queries on a table without full-text index on that column?</strong></p>
<blockquote><p><strong>No: </strong>Before you can run full-text queries on a table, the database administrator must create a full-text index on the table. The full-text index includes one or more character-based columns in the table. These columns can have any of the following data types: char, varchar, nchar, nvarchar, text, ntext, image, xml, or varbinary(max) and FILESTREAM.</p></blockquote>
<p><strong>Are Full-text queries are case-sensitive?</strong></p>
<blockquote><p>Full-text queries are not case-sensitive. For example, searching for &#8220;DBRND&#8221; or &#8220;dbrnd&#8221; returns the same results.</p></blockquote>
<p><strong>What is the difference between LIKE and FULL-Text Search?</strong></p>
<blockquote><p>In contrast to full-text search, the LIKETransact-SQL predicate works on character patterns only. Also, you cannot use the LIKE predicate to query formatted binary data. Furthermore, a LIKE query against a large amount of unstructured text data is much slower than an equivalent full-text query against the same data.</p>
<p>A LIKE query against millions of rows of text data can take minutes to return; whereas a full-text query can take only seconds or less against the same data, depending on the number of rows that are returned.</p></blockquote>
<p><strong>What is a Full-Text Engine?</strong></p>
<blockquote><p>The Full-Text Engine in SQL Server is fully integrated with the query processor. The Full-Text Engine compiles and executes full-text queries. As part of query execution, the Full-Text Engine might receive input from the thesaurus and stoplist.</p></blockquote>
<p><strong>What is the internal process of Full-Text Querying?</strong></p>
<ul>
<li>The query processor passes the full-text portions of a query to the Full-Text Engine for processing. The Full-Text Engine performs word breaking and, optionally, thesaurus expansions, stemming, and stopword (noise-word) processing.</li>
<li>Then the full-text portions of the query are represented in the form of SQL operators, primarily as streaming table-valued functions (STVFs).</li>
<li>During query execution, these STVFs access the inverted index to retrieve the correct results. The results are either returned to the client at this point, or they are further processed before being returned to the client.</li>
</ul>
<p><strong>What is CONTAINS and FREETEXT of Full-Text predicates?</strong></p>
<blockquote><p>The CONTAINS and FREETEXT predicates return a TRUE or FALSE value. They can be used only to specify selection criteria for determining whether a given row matches the full-text query. Matching rows are returned in the result set. CONTAINS and FREETEXT are specified in the WHERE or HAVING clause of a SELECT statement. They can be combined with any of the other Transact-SQL predicates, such as LIKE and BETWEEN.</p>
<p>When using CONTAINS or FREETEXT, you can specify either a single column, a list of columns, or all columns in the table to be searched.</p></blockquote>
<p><strong>What it is not recommended to name the user defined Stored Procedures with sp_?</strong></p>
<blockquote><p>They are system defined and mostly resides under the master database so if we write a user defined stored procedure by the name sp_ the query engine will first search the Stored Procedure in the master database and if not found then it will search in the current session database.</p>
<p>This brings unnecessary round trip and reduce the overall performance of user defined stored procedures.</p></blockquote>
<p><strong>Can we use the PRINT statement in SQL Server Function?</strong></p>
<blockquote><p>No: We cannot use it.</p></blockquote>
<p><strong>If you are working on a SQL database and if suddenly a developer changes the code and your queries results start giving errors, how will you check using a T-SQL query (on system tables) that what has changed in the database.</strong><br />
<pre class="crayon-plain-tag">select o.name, o.object_id, o.modify_date, c.text
from sys.objects o
join sys.syscomments c
on o.object_id = c.id</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
