Stored procedure to generate HTML tables for SQL Server query output
The procedure was created and tested with: SQL Server 2014 and 2016 Standard Edition Note that sys.dm_exec_describe_first_result_set dynamic is available with SQL Server 2012 and later.
View ArticleTrigram Wildcard String Search in SQL Server
These articles were written by several of the SQL Server industry’s leading experts, including Aaron Bertrand, Paul White, Paul Randal, Jonathan Kehayias, Erin Stellato, Glenn Berry, and Joe Sack....
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 ArticleSUBSTRING (Transact-SQL)
Returns part of a character, binary, text, or image expression in SQL Server. The following example shows how to return only a part of a character string. From the sys.databases table, this query...
View ArticleSQL SERVER – Remove Duplicate Chars From String – Part 2
I have already made a post on SQL SERVER – UDF – Remove Duplicate Chars From ... SET @result='' SELECT @result=@result+min(substring(@string ,number,1)) FROM ( SELECT number FROM master..spt_values...
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 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 ArticleCreate custom looping procedures in SQL Server 2005
In my previous SQL Server article, I discussed how you can use two undocumented ... declare @tempindex int if (substring(@cmd, @replacecharindex - 1, 1) = N'''') begin /* if ? is inside of '', we need ...
View ArticleTarget Corporation Interview Experience | Set 4 (On-Campus)
Sql query- Student (rollno, name), Marks (Rollno ... write the program to check a string is a substring of other not. 6. what are the types of database. 7. why should I hire you. 8. why should I not...
View ArticleProcessing text files with PowerShell
Comments in a T-SQL script are great for the designer to understand the ... Section F #> # Remove java script tags $main = $main.Substring(16, $main.Length-17) # Find inner document (json) $start =...
View ArticleWant to retrive numbers in words
SQL> insert into t values (789); 1 row created. SQL> SQL> select * 2 from t, 3 table(cast(multiset( 4 select substr(to_char(t.x),rownum,1) 5 from dual 6 connect by level <=...
View ArticleCSV Shredding in SQL Server and Oracle
1)-1 ) AS VARCHAR(20)) AS code_cd , SUBSTRING(rem,CHARINDEX(',',rem,1)+1,4000) rem , Level+1 AS Level FROM CTEshredding WHERE rem IS NOT NULL AND LEN(rem) > 1 ) ... Obviously I had to "roll my own"...
View ArticleStored procedure to generate HTML tables for SQL Server query output
The procedure was created and tested with: SQL Server 2014 and 2016 Standard Edition Note that sys.dm_exec_describe_first_result_set dynamic is available with SQL Server 2012 and later.
View ArticleProcessing text files with PowerShell
Comments in a T-SQL script are great for the designer to understand the ... Section F #> # Remove java script tags $main = $main.Substring(16, $main.Length-17) # Find inner document (json) $start =...
View ArticleDetermine Which Cluster Node Failed
The following SQL statement shows how to use the sys.dm_pdw_component_health_active_alerts system view to find the name of the server that failed. SELECT SUBSTRING( component_instance_id, 2,...
View ArticleORA-06502 with CHAR parameter. What am I missing?
The only thing i can think is that in the procedure proc, pl/sql is changing (in the proc parameter) test_col.col%type with char(4000) or something like this. If i use in pcol (at the select into) a...
View ArticleExecute Python Scripts with Management Studio to Securely Import Data into...
Populating a table in SQL Server with stock prices downloaded with Python After ... from #Result into columns of a second -- temp table (#Resultprocessed) select cast((SUBSTRING(line,1,10)) as date)...
View Article#Review of SQL Cop unit tests collection
SQL Server normally handles ‘old-style’ join syntax quite well in most cases. However, in certain scenarios, the use of an ‘unqualified’ join syntax can cause poor query performance. select a.id,...
View ArticlePhpCollab 2.5.1 SQL Injection
project=1'+and+(SELECT+SLEEP(5)+FROM+members+where+login+like+0x61646d696e+and+substr(password,1,1)+like+CHAR(116))+and+ ... HTTP request allows an attacker to extract data using SQL injections in the...
View ArticleHResults. DTS_E_EXPREVALSTATIC_FNSUBSTRINGINVALIDSTARTINDEX Field
MessageId: DTS_E_EXPREVALSTATIC_FNSUBSTRINGINVALIDSTARTINDEX MessageText: The start index was not valid for function SUBSTRING. The start index value must be an integer greater than zero. The start...
View Article