In previous articles I explained SQL Query to get particular part of string, SQL Query to replace part of string, kill all active database connections in SQL Server, SQL Query to read xml file, SQL Query to get month wise, year wise data and many articles relating to SQL Server, jQuery, JavaScript. Now I will explain how to check if string contains specific word in SQL Server.
CHARINDEX ( StringToFind ,OverAllStringToSearch [ , start_location ] )
|
DECLARE @str VARCHAR(250)
SET @str='Welcome to
Aspdotnet-Suresh.com'
SELECT CHARINDEX('Aspdotnet',@str)
|
---------------------------------------
(1 row(s) affected)
|
DECLARE @str VARCHAR(250)
SET @str='Welcome to
Aspdotnet-Suresh.com'
SELECT CHARINDEX('Aspdotnet',@str,7)
|
---------------------------------------
(1 row(s) affected)
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
0 comments :