SQL 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 ArticleWhat do we mean by Substring function in Sql Server?
Substring function is a Sql Server in-built function which is used to extract a portion of text or character from a given string.We can get any characters from withing any string value....
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 ArticleSQL Server SUBSTRING Function with Examples
In one of my previous articles, I have explained the functionalities of CHARINDEX function with examples. Along with it I also have briefly described the use of SQL Server SUBSTRING() function too. An...
View ArticleEasily Import CSV Files with R in SQL Server 2016
exec" sql statement for the corresponding staging table declare curFile cursor for select ltrim(rtrim(fullname)) from @tmpFile open curFile; fetch next from curFile into @fullname; while @@FETCH_STATUS...
View ArticleDeconstructing Extended Event XML
sql_text, stackframe.value('(@level)[1]', 'int') AS [level], stackframe.value('xs:hexBinary(substring((@handle)[1], 3))', 'varbinary(max)') AS [handle], stackframe.value('(@line)[1]', 'int') AS [line],...
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 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 ArticleSQL Browser, what is it good for? Absolutely something!
SQL Browser service must be running or this script will not ... res = "" If ($Response) { $Response = $Response.Substring(3,($Response.Length-3)).Replace(";;","~") $Response.Split("~") | ForEach {...
View ArticleSubstrings in SQL
FROM tab1 ORDER BY col1[1,3] .. while Microsoft SQL SERVER provides the SUBSTR() function, to extract a substring from a string expression: SELECT .... FROM tab1 WHERE SUBSTRING(col1,2,2) = 'RO' SELECT...
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 ArticleScript to quickly find SQL Server DBCC CHECKDB Errors
RETURN rtrim(ltrim(substring (@str, @p1 + len(@str1) , @p2 - len(@str1) - @p1 ))) END GO Each DBCC CHECKDB statement logs a line to the current SQL Server Error Log (current log). This line states that...
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 Browser, what is it good for? Absolutely something!
SQL Browser service must be running or this script will not ... res = "" If ($Response) { $Response = $Response.Substring(3,($Response.Length-3)).Replace(";;","~") $Response.Split("~") | ForEach {...
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 Articleconvert CLOB data over 4K character to character
and we said... You can use dbms_lob.substr to extract the first 4,000 characters. This returns a varchar2. So you can do a distinct on this in SQL: create table t ( x clob ); declare tmp clob; begin...
View ArticleScript to quickly find SQL Server DBCC CHECKDB Errors
RETURN rtrim(ltrim(substring (@str, @p1 + len(@str1) , @p2 - len(@str1) - @p1 ))) END GO Each DBCC CHECKDB statement logs a line to the current SQL Server Error Log (current log). This line states that...
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 Developer Data Modeler: A Top-Down Product Overview
SQL Developer Data Modeler offers features and utilities that ... and alphanumeric constants and combining these, optionally with the SUBSTR function to restrict the total length of the word. Once...
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 Article