How to calculate barcode check-digit using T-SQL language
How can you translate the standard algorithm to T-SQL code? One possible solution could be implemented ... tmpCode)) BEGIN SET @List = @List + '|' + LTRIM(RTRIM(STR(@j))) + ';' + SUBSTRING(@tmpCode,...
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 ArticleHey, those variables don't grow on trees, y'know!
And it's almost exactly what fish described in the meeting: He uses a substring function to extract the date and time from the filename and store them into two variables, then concatenates the two...
View ArticleSQL Saturday #Chattanooga is THIS WEEK!
This will let you use SQL naturally, enabling the query engine internals to optimize your output needs without you needing to spend a lot of time thinking about it. This will mean less time trying to...
View ArticleHow to Decipher sysschedules
SQL 2012 includes the FORMAT function that would have allowed ... LEFT(RIGHT('000000' + CONVERT(VARCHAR(6), @time), 6), 2) + ':' + SUBSTRING(RIGHT('000000' + CONVERT(VARCHAR(6), @time), 6), 3, 2) + ':'...
View ArticleSubstring for data in dataset and sql table
With the guides and helps from fellow members here, i now can have data from dictionary in dataset by using this code: data want; set sashelp.vcolumn (where=(libname="CDSSTG")); run; However, i want to...
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 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 ArticleChange a Substring with SQL
However, my SQL command gives me an invalid token error at the opening parenthesis of SUBSTR in the SET statement. Is there a rule that you can’t use SUBSTR in a SET statement? If so, do you have a...
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 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 ArticleHow to calculate barcode check-digit using T-SQL language
How can you translate the standard algorithm to T-SQL code? One possible solution could be implemented ... tmpCode)) BEGIN SET @List = @List + '|' + LTRIM(RTRIM(STR(@j))) + ';' + SUBSTRING(@tmpCode,...
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 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 ArticleChange a Substring with SQL
However, my SQL command gives me an invalid token error at the opening parenthesis of SUBSTR in the SET statement. Is there a rule that you can’t use SUBSTR in a SET statement? If so, do you have a...
View ArticleReplace Bad Characters in Table
DECLARE @good varchar(50) = 'abcdefghijklmnopqrstuvwxyz 0123456789,.:;''' create TABLE #approved (letter VARCHAR(1)) INSERT #approved (letter) SELECT SUBSTRING(W.WORD, T.idx, 1) FROM (SELECT @good as...
View ArticleHow to calculate barcode check-digit using T-SQL language
How can you translate the standard algorithm to T-SQL code? One possible solution could be implemented ... tmpCode)) BEGIN SET @List = @List + '|' + LTRIM(RTRIM(STR(@j))) + ';' + SUBSTRING(@tmpCode,...
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 Saturday #Chattanooga is THIS WEEK!
This will let you use SQL naturally, enabling the query engine internals to optimize your output needs without you needing to spend a lot of time thinking about it. This will mean less time trying to...
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 Article