Case When Between issue
I have a list of suppliers and their next review date. The date is always on a Monday but there could be some outliers in that week. Right now I'm using the DW part of GETDATE and adding a value so...
View ArticleTuning Query In Stored Procedure
Below table contains five millions of records.My Table Structure[code language="sql"]CREATE TABLE [dbo].[T_PDF]( [F_PRODUCT] [varchar](50) NOT NULL, [F_LANGUAGE] [varchar](
View Articleinsert from linked server did not enforce table constraints
I have a table with an Hours column that allows null and has a default constraint of 0. When I'm importing into that table from SSIS or a standard query it defaults all the null values to 0. When I...
View ArticleRemove duplicate substrings from string
Hello experts, I have a problem I'd appreciate advice on please.I'm asked to determine distinct combinations of sequences of values from a field which contains delimited values. My issue is that I need...
View ArticleWrite to table, send email, mark as sent
I have a few triggers but know they can cause issues if everything doesn't fire correctly. What I would like is to do is write the data to a table or use a view to collect the data. I'd then create a...
View ArticleTSQL - SQL Server Migration Assistant (SSMA) error
Hi All,We are working on few projects to migrate Sybase ASE DB schema to MSSQL 2014 using SSMA and while conversion below errors were noticed.I don't see any issues while executing the scripts and SP's...
View ArticleShowing 2 parameters "in line" on one line of an output
Hi thereI'm trying to work out how to show 2 or more parameters from one column on a line next to each other. What I mean is this...My database has a table called PARAMETER which can hold multiple...
View Articlecontrol order of execution within a stored procedure?
I have problem where a stored procedure is daily executed as part of an SSRS subscription, but the last of 3 statements within the procedure fails validation ie. expected UPDATES in SourceTable are...
View ArticleFOR XML - Remove attributes from FOR XML EXPLICIT
My SQL outputs the following XML with attributes:<Order_Notification Level="x"><Order_Company Level="y2"> <Order Level="z3" /></Order_Company></Order_Notification>However...
View Articletruncation error on varchar(max) column
I have a table that I use to log validation messages received by users so that we know what they are having trouble with. [code language="sql"]CREATE TABLE [dbo].[ValidationLog]( &nb
View ArticleSQL : Concatenate unique values in rows based on a condition.
I have the following code to concatenate all distinct Aliasnaam per Masjien.Snippet
View ArticlePerformance Issue Problem in Stored Procedure
Hi All , I have one Stored procedure it has performance issue .Every 5 hours once if i compile the SP with "ARITHABORT" on then it is working fine.how to troubleshoot this kind of issueThanks,Sai
View ArticleConvert table data to (Embadded/Nested)JSON format in SQL server 2014
Hi, How to convert table/tables data to (Embedded/Nested) JSON format in SQL Server 2014? Task is to import data into mongodb which requires data in JSON format. Thanks in advance. Regards, Vijay
View ArticleInvalid use of a side-effecting operator 'rand' within a function
I want create a Function as follow,[code language="sql"]CREATE function [dbo].[GetSmsId]()returns INT asBEGIN ---- Create the variables for the random number generation
View ArticleThis code only inserts the first column in the temp table
After I run this code and then run Select * from #TEMPSTP, i only get one Column.It worked at one point, but i'd rather not back up to that point.Thoughts? thanks [code language="sql"]use GTM_OD
View ArticleCreate Excel (xlsx) file in SSIS/C# using Microsoft.ACE.OLEDB
Hi,I am trying to execute the below mention code in a script task in SSIS (C#). I get the error {"The Microsoft Access database engine could not find the object 'C:\\test.xlsx'. Make sure the object...
View ArticleThe specified @job_name (job_name) does not exist
I just upgraded from SQL Server 2008 to SQL Server 2014. I am receiving a push from a data warehouse owned by our IT department. Once they finish their push they are entering a timestamp into a log...
View ArticleHelp With Database Normilization
[code]SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[HSN]([MSN] [float] NULL,[SN] [nvarchar](255) NULL,[RN] [nvarchar](255) NULL,[DQ] [nvarchar](255) NU
View ArticleOptimizing a dynamic sorting SQL query
This query (I've simulated it to show you. Otherwise, it is longer with many more lists of columns, some more tables joined; and finally to sort by every column as required by the user) takes too long,...
View Article