MERGE code works but not when called via stored procedure
Hello, I have a stored procedure that is only doing 1 thing - a MERGE command. When I run the code in the stored procedure, it is successful, as soon as I put the "CREATE PROCEDURE" around it and try...
View ArticleHow to create blocking in SQL
Hi,I would like to test my SP which can capture the blocking. But how I can create a blocking scenario via SQL script?Thanks
View Articlesql server 2014 Analytical data
I have data as belowData is as shown below where every 4 row gets repeatedID ValueAA ABB BCC CAA DBB ECC FAA GBB HCC II need data as per below formatID Value1 Value2 Value3AA A D GBB B E HCC C F...
View ArticleTrying to use the HASHBYTES of a nvarcar(Max)
When I try to make a calculated field [File HASH] using hashbytes('MD5',[ASCII File]) the calculation I get the resultant field [File HASH] as a nvarchar(max)I want the field [File HASH] to be...
View ArticleReading from JSON
Hi Experts,We have a column which stores JSON , how can I query a single property in that column(ex:property:car)Thanks
View ArticleStrange performance of simple query: sometimes fast, sometimes slow
I've run into a weird situation with a query that sometimes runs blazing fast (<1ms) but at other times can take around 500ms. For a less frequently executed query this wouldn't be such a problem...
View ArticleInsertig failed records into a different table than good records.
I've been building an SSIS package in SQL 2014. I am running a query and inserting the returned data into a staging table before I create three separate CSV files from three separate queries of the...
View ArticleYYYY-MM-ddTHH:mm:ssZ Format Error
Hi,I'm trying to insert a date with the YYYY-MM-ddTHH:mm:ssZ format into a field with the type datetime but I'm getting an error: Conversion failed when converting date and/or time from character...
View ArticleDATEDIFF format
Hi,I use the below code, I can get the duration as hh:mm:ss.0000000. [code="sql"]CONVERT(TIME, DATEADD(SECOND, DATEDIFF(SECOND, last_request_end_time, GETDATE()), 0), 114) AS Duration[/code]But how I...
View ArticleTime Zones
Good morning :-)I have a table that if you dont add the date, by defult it will add the date.[code="sql"]create table Raw_Data( ID int identity primary key,DateCreated datetime NOT NULL...
View Articlebai file electronic cash management
Our bank is sending us daily files in regard to bank postings. The files are in a standard banking format called BAI. We would like to load the BAI files into sql server for analysis and reporting.I'm...
View ArticleShow millisecond value
Hi,I have the below SQL statement[code="sql"]select CONVERT(TIME, DATEADD(SECOND, DATEDIFF(SECOND, last_request_start_time, GETDATE()), 0), 114) AS Duration, * from sys.dm_exec_sessions where (status...
View ArticleSynonyms
I think the answer is 'no', but I'll ask it anyway. I have two databases on different servers referenced through linked server. Is it possible to create a synonym that encompass the linked server name,...
View ArticleHow to enable/disable Alert by script
Hi,If I set up an alert, is there any SQL script I can enable/disable it?Regards,
View ArticleSQL stored procedure help
I have a stored procedure that I inherited. The goal is for the data in the temp table: #multi_nominees_uf to be joined with the data in #temp_reviewers_UF and assign #temp_reviewers_UF.uf_rev_id to...
View ArticleIn-Line TVF Split Function JOIN to Base Tables Optimization
I have a specific question about JOINing results of an in-line split function to base tablesI am using an in-line TVF and joining to base tables. Sample code below.The problem is the optimizer does not...
View ArticleMsg 9420, Level 16, State 1, Line 6 XML parsing: line 2, character 33,...
Hi,When I run an SQL query, sometimes I got the error,[quote]Msg 9420, Level 16, State 1, Line 6XML parsing: line 2, character 33, illegal xml character[/quote]and sometimes is okay. What would be the...
View ArticleClr procedure to load dll assembly using Reflection
Hi,I'm trying to load an assembly in order to instantiate a class and execute a method that returns a data table.Assembly file (*.dll) resides on a local drive (d:\temp\my.dll)I managed to load the...
View ArticleIssue with slow find and replace function code from a lookup table can I do...
I have some dim tables for find and replace for colours and sizes as I have multiple columns in a table that could hold the value see below,FilterColour = CASE WHEN (SELECT lc.ReturnString FROM...
View ArticleCount the occurrence of word in a Resume Table
I have a table called Resume with columns in Text, Word and PDF format. I enabled Full Text Search on the table and able to search the keyword through three columns and also able to rank the profile...
View Article