10 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 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 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 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 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 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 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 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 Article