In this video, we will be looking at how to search for text within bigger text searches.
My SQL Server Udemy courses are:
70-461, 70-761 Querying Microsoft SQL Server with T-SQL: rebrand.ly/que...
98-364: Database Fundamentals (Microsoft SQL Server): rebrand.ly/dat...
70-462 SQL Server Database Administration (DBA): rebrand.ly/sql...
Microsoft SQL Server Reporting Services (SSRS): rebrand.ly/sql...
SQL Server Integration Services (SSIS): rebrand.ly/sql...
SQL Server Analysis Services (SSAS): rebrand.ly/sql...
Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): rebrand.ly/mic...
----
In this video, I'll show you how to use the SQL Server functions CHARINDEX and PATINDEX to search for text in a table.
These functions are useful if you need to find a specific piece of text in a table. They both have the same syntax, so you can use either one depending on what you need. I'll also show you some examples of how to use these functions to search for text in a table. Thanks for watching!
CHARINDEX - this is the SQL Server equivalent of INSTR or FIND. SQL Server is 1-based, so the first character is character number 1, not 0. You can either start searching from the beginning, or from partway through the string.
PATINDEX - sometimes, looking for string literals is not sufficient. You may need to use wildcards such as % and _ as well. This is when you use PATINDEX. However, you must start searching from the beginning with PATINDEX.
21 авг 2024