Detecting outliers and fraud with R and SQL Server on my bank account data –...
One of the samples Microsoft provided with release of new SQL Server 2016 was using simple logic of Benford ... get_first_num <- function(number){return(as.numeric(substr(number,1,1)))} pbenford...
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 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 ArticleUsing 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 ArticleVisualization Dashboard with Couchbase Analytics
var qs = 'SELECT ' + ' parse_date(SUBSTR(e.date, 0, 10), "Y-M-D") AS grpdate ... res.send({ data: qres, narration: [ ['sql', qs] ] }); }); In addition to the RESTful service provided by the server-side...
View ArticleOracle Row Level Security: Part 2
SQL> col sql_text for a25 SQL> col predicate for a20 SQL> col policy for a15 SQL> col object_name for a15 SQL> select substr(sql_text,1,25) sql_text, 2 predicate, 3 policy, 4 object_name...
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 ArticleSQL Analysis from Locking Event Monitor Collecting History
I used this SQL to do that population, directly from the tables created ... as weighted_diff , decimal(((cost_before-cost_after)*frequency)/(cost_before*frequency),5,2) as diff_pct ,...
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 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 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 ArticleCalling SQL Functions From RPG, A Service Program
Subprocedures are not provided for SQL scalar functions that have a direct RPG equivalent (e.g. SUBSTR) or that only make sense when used with multiple rows (e.g. the XML functions). The library...
View ArticleUsing 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 ArticleCalling SQL Functions From RPG, A Service Program
Subprocedures are not provided for SQL scalar functions that have a direct RPG equivalent (e.g. SUBSTR) or that only make sense when used with multiple rows (e.g. the XML functions). The library...
View ArticleRegular Expression Support in Oracle (REGEXP_COUNT, REGEXP_INSTR,...
SELECT * FROM t1 WHERE TO_NUMBER(REGEXP_SUBSTR(data, '\d{4}')) >= 2014; DATA ----- FALL 2014 2014 CODE-B CODE-A 2014 CODE-D 3 rows selected. SQL> The first part ...
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 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 ArticleUsing 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 ArticleWhat's New in Database Engine
Transact-SQL Improvements for memory-optimized tables There are several ... Parameters passed into string functions, such as into LTrim or Substring, in a native proc. Inline (meaning single statement)...
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 Article