Viewing 15 posts - 1 through 15 (of 1,218 total)
With no readily available test data, I would try to edit the 1st CTE as follows
;with ClockIn as(select [Initial],[RFID],[Time] as ClockInTime from Data where Type=1 and [Time]...
September 6, 2021 at 9:29 am
Thank you DesNorton,
I got that, my question was how can I incorporate that in this single statement, that null values update always need to check for all columns, if...
June 25, 2021 at 10:59 am
You could use ISNULL for your update, so that it does not replace existing values with NULL.
Something like this ....
UPDATE destSET dest.Value = ISNULL(src.Value, Dest.Value)FROM SourceTable AS...
June 25, 2021 at 6:51 am
Brief tangent into real SQL stuff...
Has anyone ever heard of table triggers not firing for every row if you do set-based updates to records?
Our vendor sent us code for...
June 14, 2021 at 1:12 pm
I would change the data types in the #SourceTable. Or at least create another intermediate process that cleans/types the data. Otherwise, you are asking for a world of hurt
May 26, 2021 at 6:36 am
Please read this article on upserts and concurrency http://source.entelect.co.za/why-is-this-upsert-code-broken
From the above, you should end up with code that looks like this
May 26, 2021 at 6:04 am
For the above to work, TableName1 and TableName2 would need to have have the same structure.
Since the structure is the same, why not use
SELECT * FROM TableName1EXCEPTSELECT...
April 18, 2021 at 3:47 pm
You are hammering the same tables multiple times. You will probably get better perf if you use cross-tab queries to reduce the number of times the tables are read. I...
April 9, 2021 at 6:07 pm
I believe that your join should be
FROM Schedule INNER JOINOperations ON Schedule.WorkCenterID = Operations.Operation
April 9, 2021 at 7:26 am
// some operation insert update of my temps table @TempMrc, @TempReport
If you are only doing DML operations on the @Tables, then you should not be using a transaction, as the...
March 26, 2021 at 3:12 pm
First, you want to be using the new join format
FROM @sampledata1 AS A1CROSS JOIN @test2 ...
March 12, 2021 at 5:46 am
Your issue is that you are using a variable inside the dynamic SQL that is declared outside the dynamic SQL. For this you will need to use sp_executesql
March 10, 2021 at 7:27 am
Can THIS USER please be nuked. Every 1 of his posts has been spam.
March 8, 2021 at 7:27 am
This should do the trick
/* First get all of the records from Table1, and the Table2 values if they exist */SELECT T1.PhoneNbr, T1.Interval, T1.CountA,...
March 5, 2021 at 6:50 am
I have no idea about performance differences. Although I cannot imagine that there will be a difference, as they are the same product installed from the same media. In our...
February 25, 2021 at 11:43 am