Using POSITION Functions
When you're experimenting with substring functions, check to see if your system allows an optional third argument. If no third argument is required, and you leave it out, the SQL engine displays all...
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 ArticleSQL Server Functions to Mask Confidential Data using CLR or PowerShell
For the PowerShell approach, the strength is flexibility, i.e. you do not need to install anything inside SQL Server instance ... NoChange = $SourceData.Substring($StartNoChange); } else { $EndNoChange...
View ArticleJSON parsing – performance comparison
One of the first questions that people asked once we announced JSON support in SQL Server 2016 was “Would it be slow ... set @s = PATINDEX('%ProductName%', @json) -- set @s = SUBSTRING(@json, 10, 10)...
View Article5 Underused SQL Functions, Developer-style
In many situations, you need to get a part of a string. Again, you could do this in your web server code or you can use the SUBSTRING function in your SQL stored procedures. For instance, you might...
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 ArticleBASE64 Encode and Decode in T-SQL - optimized
ascii(substring(@map, @i + 1, 1)), 1, char(@i)) set @i = @i + 1 end set @mapr = stuff(@mapr, ascii('='), 1, CHAR(0)) select cast(@mapr as binary(122)) */ -- Original functions Created By Daniel Payne...
View ArticleT-SQL String Manipulation Tips and Techniques, Part 1
The task at hand involves counting the number of occurrences of a substring (@substr) within an input string ... of multiple contiguous spaces with one space. Peter Larsson, a SQL Server MVP, came up...
View ArticleConverting a GUID to specific number of characters.
Whilst you are here, check out some content from the AskTom team: Optimizing the PL/SQL Challenge VIII ... I was looking into some functions like REGEX_REPLACE , REGEX_SUBSTR but was not able to do...
View ArticleLoading Data into Oracle BI Cloud Service using BI Publisher Reports and REST...
PL/SQL is the only procedural tool that runs on the BICS / Database ... This step uses the : * INSTR function to determine the beginning and end of the embedded XML * SUBSTR function to extract just...
View ArticleT-SQL Substring: Splicing a String from Another String
Transact-SQL or T-SQL is a way to run SQL statements on your database tables. SQL Server offers several string functions, which you should know to properly manipulate and work with your data. The...
View ArticleSQL Server Substring with CharIndex
In this article we are going to explore the T-SQL function CharIndex and also how to use it with another T-SQL function Substring(). CharIndex: This function returns the location of a substring in a...
View ArticleUse SQL To Change A Substring
Occasionally I need to change part of a string value in a database table. SQL has three mechanisms that let me accomplish such a thing. Do you know what those three mechanisms are and how to use them?...
View ArticleUsing substring and ltrim in Alteryx
I have the below sql code and want to convert this to alteryx formula and apply to dataset below. isnull(SUBSTRING(rtrim(ltrim(hhm.Surname)),2,1),'2 ')...
View ArticleString Comparisons in SQL: The Longest Common Substring.
I’ve always wanted a SQL function that tells me the longest substring shared between two strings. As a present to myself, I’ve written one. I hope someone else finds it useful. There are several...
View ArticleSQL SUBSTRING Function
The SQL SUBSTRING function is one of the SQL String Function, which is used to return specified number of characters from the given expression. The SUBSTRING function uses its third argument to decide,...
View ArticleCreate features for data in SQL Server using SQL and Python
This can be done by using SQL or by using a programming language like Python ... (ABS() - FLOOR(ABS()),6),1)) >= 1 then substring(PARSENAME(round(ABS() - FLOOR(ABS(
View ArticleOptimizing Substring Search Performance in SQL Server
The requirement of searching data by part of the value is very common in business applications. All of us are familiar with it – users want to be able to search by entering just a few letters from the...
View ArticleSupported Features for Natively Compiled T-SQL Modules
String functions: LEN, LTRIM, RTRIM, and SUBSTRING. Applies to: SQL Server vNext CTP 1.1. Beginning with SQL Server vNext CTP 1.1, the following built-in functions are also supported: TRIM, TRANSLATE,...
View ArticleSQL Server Functions to Mask Confidential Data using CLR or PowerShell
For the PowerShell approach, the strength is flexibility, i.e. you do not need to install anything inside SQL Server instance ... NoChange = $SourceData.Substring($StartNoChange); } else { $EndNoChange...
View Article