Splitting CSV strings in SQL 2016
One using casts the string as XML and then parses the nodes to return a table and the other uses a very inefficient looping operation with charindex and substring. For performance reasons I’ve always...
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 ArticleTechTip: C# for RPGers: Not All Strings Are Born Equal
Substring is very similar to an RPG BIF ... His areas of expertise include programming in the IBM i native languages (RPG, CL, and DB2 SQL) and "modern" programming languages, such as C# and Python, as...
View ArticlePattern Matching : More Fun When I Was a #Kid
In one case, the person cited an article by David Lozinski, "SQL: LIKE vs SUBSTRING vs LEFT/RIGHT vs CHARINDEX." Yes, the article shows that, in the contrived example, CHARINDEX performed best....
View ArticleOracle SUBSTR Function Explained with Examples
The Oracle SUBSTR function is used to get a smaller string (the substring ... The only way that I know of to get a SUBSTR from a LONG variable is to write a PL/SQL procedure that takes a ROWID, then...
View ArticleSQL and Data. Learning to Retrieve Data Efficiently and Accurately
Execute SQL*Plus Type describe billing_accounts Type desc orders Type SELECT???? FROM billing_accounts bact, orders ord WHERE bact.id = ord.bact_id AND substr(ord.name,1,3) = 715 AND bact.rentyp_id...
View ArticleOptimizing SQL Server CPU Performance
For more information on SQL traces, see msdn2.microsoft.com/ms191006.aspx. SELECT substring(text,qs.statement_start_offset/2 ,(CASE WHEN qs.statement_end_offset = -1 THEN len(convert(nvarchar(max),...
View ArticleSplitting CSV strings in SQL 2016
One using casts the string as XML and then parses the nodes to return a table and the other uses a very inefficient looping operation with charindex and substring. For performance reasons I’ve always...
View ArticleT-SQL: RIGHT, LEFT, SUBSTRING and CHARINDEX Functions
This article explains the functionality and uses of the LEFT, RIGHT, SUBSTRING and CHARINDEX functions in SQL. This article will leave you with sound knowledge and understanding that you can take away...
View ArticleUnderstanding your SQL Server Fragmentation
So, now the time to see WHY SQL Server can’t shrink our file ... Object_Name(@i) + ']' , CONVERT(GEOMETRY,'POLYGON(' + SUBSTRING( ( SELECT ',(' + CONVERT(VARCHAR, (page_id % @d) * 10) + ' ' +...
View ArticleDB2 for z/os Migration: Query Performance Considerations
HEX(SUBSTR(IBM_SERVICE_DATA,9,4)) AS SORT_POOL_SIZE FROM PLAN_TABLE WHERE QUERYNO=6475 *NOTE 1: CPU count is only populated if query chooses parallelism **NOTE2: Search Modeling a production...
View ArticleSQL - String Functions
SQL> UPDATE table_test -> SET blob_col=LOAD_FILE('/tmp/picture') -> WHERE id=1; ..... The first syntax returns the position of the first occurrence of substring substr in string str. 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 ArticleTop 80 + SQL Query Interview Questions and Answers with Examples
Oracle Equivalent of SQL Server SUBSTRING is SUBSTR, Query : select substr(FIRST_NAME,0,3) from employee SQL Server Equivalent of Oracle SUBSTR is SUBSTRING, Query : select substring(FIRST_NAME,1,3)...
View ArticleUnderstanding your SQL Server Fragmentation
So, now the time to see WHY SQL Server can’t shrink our file ... Object_Name(@i) + ']' , CONVERT(GEOMETRY,'POLYGON(' + SUBSTRING( ( SELECT ',(' + CONVERT(VARCHAR, (page_id % @d) * 10) + ' ' +...
View ArticleSplitting CSV strings in SQL 2016
One using casts the string as XML and then parses the nodes to return a table and the other uses a very inefficient looping operation with charindex and substring. For performance reasons I’ve always...
View ArticleUse PowerShell to Determine the number DML operations in SQL Server Scripts
We can use one of my favorite libraries to do this easily - .NET's very fast StreamReader, for reading a SQL file. Likewise, since PowerShell uses .NET, this library includes many useful built in...
View ArticleOracle SUBSTR Function Explained with Examples
The Oracle SUBSTR function is used to get a smaller string (the substring ... The only way that I know of to get a SUBSTR from a LONG variable is to write a PL/SQL procedure that takes a ROWID, then...
View ArticlePattern Matching : More Fun When I Was a #Kid
In one case, the person cited an article by David Lozinski, "SQL: LIKE vs SUBSTRING vs LEFT/RIGHT vs CHARINDEX." Yes, the article shows that, in the contrived example, CHARINDEX performed best....
View ArticleSQL - String Functions
SQL> UPDATE table_test -> SET blob_col=LOAD_FILE('/tmp/picture') -> WHERE id=1; ..... The first syntax returns the position of the first occurrence of substring substr in string str. The...
View Article