June 28, 2012 at 4:08 pm
Unfortunately I'm unable to duplicate the problem and it is just a simple UPDATE Statement.
The Data originated from an old AS400 Legacy System.
I was asked for help from the former CIO with a DTA error.= and I mentioned it to him and he told me that he ran into a similar issue and it had to do with the Data.
I will figure it out tomorrow.
Thanks.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 28, 2012 at 4:36 pm
I don't know what I was thinking on the CASE UPDATEs.:blush: dah.
I figured out how to solve the problem.
The first step is to INSERT records from another into a Table.
If I do a left JOIN with two other tables and use CASE Statements in an INSERT INTO ... SELECT I should get the intended results.
I will try in the morning, I have worked almost 50 hours this week already.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 29, 2012 at 5:57 am
I'm trying to get all the records from the History Table (39,026) but after I join I get only 26,086.
What is wrong with my statement and how can I get all of the records in the History Table?
SELECT *
FROM HISTORY AS Hist
LEFT OUTER JOIN Account AS Act ON Act.AccountNumber= Hist.AccountNumber
LEFT OUTER JOIN Current AS Cur ON Cur.AccountNumber = Hist.AccountNumber
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 29, 2012 at 6:16 am
Welsh Corgi (6/29/2012)
I'm trying to get all the records from the History Table (39,026) but after I join I get only 26,086.What is wrong with my statement and how can I get all of the records in the History Table?
SELECT *
FROM HISTORY AS Hist
LEFT OUTER JOIN Account AS Act ON Act.AccountNumber= Hist.AccountNumber
LEFT OUTER JOIN Current AS Cur ON Cur.AccountNumber = Hist.AccountNumber
Show your WHERE clause.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 29, 2012 at 6:21 am
I do not intend to use a WHERE Clause is ths scenario.
After I got the record COUNT correct I was going to incorporate an INSERT INTO with CASE Statments on the SELECT Statement.
Thanks.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 29, 2012 at 6:29 am
Welsh Corgi (6/29/2012)
I do not intend to use a WHERE Clause is ths scenario.After I got the record COUNT correct I was going to incorporate an INSERT INTO with CASE Statments on the SELECT Statement.
Thanks.
So in this query:
Welsh Corgi (6/29/2012)
I'm trying to get all the records from the History Table (39,026) but after I join I get only 26,086.What is wrong with my statement and how can I get all of the records in the History Table?
SELECT *
FROM HISTORY AS Hist
LEFT OUTER JOIN Account AS Act ON Act.AccountNumber= Hist.AccountNumber
LEFT OUTER JOIN Current AS Cur ON Cur.AccountNumber = Hist.AccountNumber
There was no WHERE clause, and yet, your rowcount is less than if you simply comment out the two left joins?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 29, 2012 at 6:50 am
If I comment out the LEFT JOIN's I get 39,028 Records.
With the LEFT JOIN's uncommented I get 26,0876 records.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 29, 2012 at 7:06 am
The person who normally works with this data is going to complete the UPDATEs one at a time so I'm off the hook but a bit baffled.
Thanks.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 29, 2012 at 7:06 am
Welsh Corgi (6/29/2012)
If I comment out the LEFT JOIN's I get 39,028 Records.With the LEFT JOIN's uncommented I get 26,0876 records.
And that's the exact same query that you are running? No extra bits anywhere?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 29, 2012 at 7:13 am
It is a Simple Query. I just wanted to get the record counts right before I added a bunch of CASE Statements.
As soon as I add the first LEFT JOIN my record count drops.:unsure:
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 29, 2012 at 7:15 am
Welsh Corgi (6/29/2012)
It is a Simple Query. I just wanted to get the record counts right before I added a bunch of CASE Statements.As soon as I add the first LEFT JOIN my record count drops.:unsure:
Is it exactly the same?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 29, 2012 at 7:27 am
It is exactly the same. Positively.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 29, 2012 at 8:09 am
Curiousier and Curiousier...
June 29, 2012 at 8:21 am
No need to reply to this thead, thank you.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Viewing 14 posts - 16 through 28 (of 28 total)
You must be logged in to reply to this topic. Login to reply