SQL 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 ArticleOne way to get an index seek for a leading %wildcard
As you would expect, SQL Server needs to perform a scan to locate those two ... much the estimated and actual rows jump here – meaning that this may be a common substring pattern. The original LIKE...
View ArticleThe Team Data Science Process in action: using SQL Server
The SQL Server VM image that is optimized for datawarehousing ... FLOOR(ABS(pickup_longitude)),6),1)) >= 1 THEN SUBSTRING(PARSENAME(ROUND(ABS(pickup_longitude) -...
View ArticleHow to Find Queries Using an Index (and Queries Using Index Hints)
SQL Server stores query execution plans in cache ... Execution plan cache */ SELECT querystats.plan_handle, querystats.query_hash, SUBSTRING(sqltext.text, (querystats.statement_start_offset / 2) + 1,...
View ArticleHow to administer SQL Server Reporting Services (SSRS) subscriptions using...
they still support basic built-in functions that can be used across all versions of SQL Server i.e. SUBSTRING, REPLACE. Not surprisingly, there are PowerShell commands that can be executed against most...
View ArticleT-SQL UDF Quickly Determines How Often a Substring Appears
Microsoft SQL Server 2005 or Microsoft SQL Server 2000 database administrators sometimes come across the problem of hitting the 900-bytes limit for unique constraints. To work around the 900-byte...
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 ArticleParallel Bulk Data Import Using SQL Partition Tables
For more information about the default file locations, see File Locations for Default and Named Instances of SQL Server. DECLARE @data_path nvarchar(256); SET @data_path = (SELECT...
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 ArticleSQL Server Function to Encrypt Integer Values
I coded two very short and simple T-SQL functions that do integer encryption and decryption ... WHILE @Idx < LEN(@encryptString) BEGIN SET @Letter = SUBSTRING(@ReversedEncryptString, @Idx + 1, 1)...
View ArticleQuestion on ORA-12899: value too large
We have a migration project which from Sybase SQL Anywhere to Oracle ... and the business logic is complicated ,We tried to find out these kind of case and use Substr. But we still worried about this...
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 ArticleOne way to get an index seek for a leading %wildcard
As you would expect, SQL Server needs to perform a scan to locate those two ... much the estimated and actual rows jump here – meaning that this may be a common substring pattern. The original LIKE...
View ArticleParse Dynamics AX Context Info
SELECT SUBSTRING(REPLACE(LTRIM(CAST(s.context_info AS VARCHAR(256 ... This is not the spid within SQL Server. Rather this is the session id that is a different value within AX. The second piece of...
View ArticleFollow-up #1 on leading wildcard seeks
To simplify from the previous post, let's assume we have the following tables – a set of Companies, and then a CompanyNameFragments table that allows for pseudo-wildcard searching against any substring...
View ArticleAnalyze #Flight delay data by using Hive in HDInsight
Azure SQL Database. You use an Azure SQL database as a destination ... CREATE TABLE delays AS SELECT YEAR AS year, FL_DATE AS flight_date, substring(UNIQUE_CARRIER, 2, length(UNIQUE_CARRIER) -1) AS...
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 ArticleORA-30926 While Using impdp Over a Database Link
So that’s what I did: SQL> SELECT comp_id, status, SUBSTR(version,1,10) version, comp_name FROM dba_registry ORDER BY 1; COMP_ID STATUS VERSION COMP_NAME ...
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 ArticleHow to Import / Export CSV Files with R in SQL Server 2016
The complete T-SQL script is shown here ... filename <- basename(filepath) filename <- paste("dbo.[", substr(filename,1, nchar(filename)-4), "]", sep="") #remove .csv suffix conn <-...
View Article