load data into 3 separate tables using tsql .
Hi All, I have below table. Basically, I dumped testddata as is to a table. now i want the data to be separated. Little background. Entrie data is 1 day worth data and assume that we get this data on...
View ArticleRecursive CTE - displaying all ancestors in result set
I am writing a recursive cte that shows the relationships of containers that are nested inside each other (like a BOM relationship) and displays them in order so that containers nested inside a parent...
View Articleexec (@sp) running twice
Hi,I have some code that's been running fine 99% of the time but sometimes it executes the same stored procedure twice for an unknown reason.So this is the code:[code language="sql"]DECLARE @sp
View ArticleCompare Data From Two Tables and Show The Side-By-Side Differences
I have two tables tblData2017 and tblData2018 that I want to see thedifferences from the two tables.
View ArticleQuery help
Hi All,Need some help in tsql. This is my table. I have put some sample data and expecting output as shown in the below screenshot .For every new start of 1,2 a new txnid should be generated whic
View ArticleDate format check
Hello all,I have few records in a table. And I want to check if one of the string column starts with date in mm/dd/yyyy or mm.dd.yyyy or mm-dd-yyyy format only. No other date formats should be allowed.
View ArticleFailed to start debugger - Data is Null.
I'm a developer working on a web application using an instance of SQL Server 2014. I use Visual Studio 2010 sp1 for development. For a task I'm currently working on, I'd like to use the SQL Server...
View ArticleTrigger after update not working when updating 2 or more rows
Hello,whats wrong here, when I update only one row everything is fine. But when there are more then one rows, the trigger and the update doesn´t work.[code language="sql"]ALTER TRIGGER [dbo].[xxatr_slauf_
View ArticleScope of Variables in Stored Procedure
I have simple statement:USE iMIS_DevGO--BEGIN TRANDECLARE @ID INTDECLARE @CODE VARCHAR(15)DECLARE @BOOK VARCHAR(15)DECLARE
View ArticleOperating system error 5: "5(Access is denied.)".
HiCan anybody advise me, what is wrong or what am i doing wrong?
View ArticleHow to resolve one to many linkage
[code language="sql"]CREATE TABLE [dbo].[Client]([ID] [int] NOT NULL,[Full_Name] [char](50) NULLPRIMARY KEY CLUSTERED ([ID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IG
View ArticleIncrementing integer values within closed quotation marks and parentheses in...
I have to add incrementing integer values within closed quotation marks and parentheses. Question 1. How can I increment the integer values so that each value goes up by 1. How do I make the...
View ArticleAdd only changed or new rows to table
Hi I am a DBA who does a small bit of SSIS / TSQL development and have been given a project to read in files on a daily basis, and only add changed or new records to a target table. I've come up with...
View ArticleSSMS 2014 not opening PRC/TAB/UDF files in SQL Query Editor
I am running SQL Server 2014 SP2 CU3 on Windows 7 Enterprise. I'm unable to get SSMS to open files with extensions such as PRC, TAB, UDF, etc., with the SQL Query Editor. Other people in my shop are...
View ArticleWhat is the best design pattern for CDC and SCD2 processing
tl;dr1) Should I use MERGE, or not??? https://www.mssqltips.com/sqlservertip/3074/use-c
View ArticleQuery to find what current query the procedure is executing.
Dear All,Have a job on a server in which it executes a stored procedure that is present in other linked server; now this job's time -frame is taking more than 2 hours to get completed.The query text...
View Article0 or $0.00 instead of NULL?
[code language="sql"]SELECT '$' + CONVERT(VARCHAR(12), SUM(CAST([ie].[AMOUNT] AS MONEY)))[/code]I tried this:[code language="sql"]
View ArticleNested If statements
Hello,I have a prob with the follow stored procedure, can any one help me with this pleaseI don't know exactly when i must use begin... End, and when nothere is my codeUSE [Eurosort]GO/****** Object:...
View ArticleA different end table by parameter
Hi guys,I have loads of stored procs that gather data but need an option to be inserted into different tables.Basically they will gather the same data but at different intervals that don't mix like...
View ArticleQuery to omit single record based on data from two columns?
Hi there,I need help with a query to remove a record from a data set. I need to remove BranchNumber 44 and TillNumber 20 from the results? Below results in all BranchNumber 44 results and TillNumber20...
View Article