Parsing HTML in SQL Server
Parse the data with something else. T-SQL does have functions like REPLACE, CHARINDEX, and SUBSTRING though, perfect for searching for tags and returning just the values between them. CLRs could do it...
View ArticleSQL Substring function in SQL Server
The requirement of data refactoring is very common and vital in data mining operations. In the previous article, you’ll learn the tips for getting started with SQL string functions, including the SQL ...
View ArticleParsing HTML in SQL Server
Parse the data with something else. T-SQL does have functions like REPLACE, CHARINDEX, and SUBSTRING though, perfect for searching for tags and returning just the values between them. CLRs could do it...
View ArticlePuzzles–T-SQL Tuesday #114
I always did enjoy that subject. In any case, I solved the issue by loading some data into a table and then digging in with a few CTEs to , l = cast(substring(d, 1, el) as int) , w = cast(substring(d,...
View ArticleTrack SQL Server Database Recovery Progress – ErrorLog
The below query parse the SQL Server Error Log and gives you total time taken by ... sp_readerrorlog 0, 1, 'Recovery of database', @DBName SELECT TOP 25 [LogDate] ,SUBSTRING([TEXT], CHARINDEX(') is ',...
View ArticleNormalizing Name Data in SQL Server
My article titled "String Manipulations with SQL Server 2000" gives a quick overview of all string ... IN ('jr', 'sr', 'ii', 'md', 'iv') AND SUBSTRING(REVERSE(full_name), 3, 1) IN (' ', ',', '.') THEN...
View ArticleDealing With Upper and Lower Case Data
Within SQL Server, two functions are provided to manage the case ... INTO mytable VALUES('DDdD') -- Uppercase first letter of each value in column SELECT UPPER(SUBSTRING(A,1,1)) + ...
View ArticleHow to Query JSON Data with SQL Server 2016
the JSON columns are treated as plain text fields and can be queried only with T-SQL string and text instructions such as LIKE, SUBSTRING and TRIM. For the purpose of the demo, I built a column called...
View Article10 SQL tricks that you didn’t think were possible
In this article, Java champion Lukas Eder invites readers to take a look at 10 SQL tricks. The article is a summary of ... 99 ) SELECT array_to_string(array_agg(s ORDER BY r), '') FROM ( SELECT i, r, ...
View ArticleREGEXP_SUBSTR
REGEXP_SUBSTR extends the functionality of the SUBSTR function by letting you search a string for a regular expression pattern. It is also similar to REGEXP_INSTR, but instead of returning the ...
View ArticleComparing SQL Server and MySQL Functions
You’ll be happy to know that the following functions are usable in both MySQL and SQL Server queries without any modifications: ASCII, LEFT, LOWER, LTRIM, REPLACE, REVERSE, RIGHT, RTRIM, SOUNDEX, ...
View ArticleTrack SQL Server Database Recovery Progress – ErrorLog
The below query parse the SQL Server Error Log and gives you total time taken by ... sp_readerrorlog 0, 1, 'Recovery of database', @DBName SELECT TOP 25 [LogDate] ,SUBSTRING([TEXT], CHARINDEX(') is ',...
View ArticleHow to Query JSON Data with SQL Server 2016
the JSON columns are treated as plain text fields and can be queried only with T-SQL string and text instructions such as LIKE, SUBSTRING and TRIM. For the purpose of the demo, I built a column called...
View ArticleConverting Access Queries to SQL Server
Whew! That was a lot and honestly, there are still more topics that could be considered in depth when it comes to converting Access queries to T-SQL. I hope that the examples above are sufficient to ...
View ArticleREGEXP_SUBSTR
REGEXP_SUBSTR extends the functionality of the SUBSTR function by letting you search a string for a regular expression pattern. It is also similar to REGEXP_INSTR, but instead of returning the ...
View ArticleComparing SQL Server and MySQL Functions
You’ll be happy to know that the following functions are usable in both MySQL and SQL Server queries without any modifications: ASCII, LEFT, LOWER, LTRIM, REPLACE, REVERSE, RIGHT, RTRIM, SOUNDEX, ...
View ArticleDealing With Upper and Lower Case Data
Within SQL Server, two functions are provided to manage the case ... INTO mytable VALUES('DDdD') -- Uppercase first letter of each value in column SELECT UPPER(SUBSTRING(A,1,1)) + ...
View ArticleHow to Query JSON Data with SQL Server 2016
the JSON columns are treated as plain text fields and can be queried only with T-SQL string and text instructions such as LIKE, SUBSTRING and TRIM. For the purpose of the demo, I built a column called...
View ArticleMySQL Substring to Find a Character & Return Left
McDonnell, Steve. "MySQL Substring to Find a Character & Return Left." Small Business - Chron.com, http://smallbusiness.chron.com/mysql-substring-character-return-left-38065.html. Accessed 10...
View ArticleTRIM() in T-SQL
String manipulation in T-SQL has always felt somewhat cumbersome ... These are my examples: SELECT Result = '[' + TRIM(n) + ']' , FirstLetter = ASCII(SUBSTRING(TRIM(n), 1, 1)) FROM ( VALUES (' ') , ('...
View Article