Viewing 15 posts - 16 through 30 (of 162 total)
Here is another option to add to your list.
WITHBaseData
AS(
SELECTmemid,
memtype,
mdate,
ROW_NUMBER() OVER (PARTITION BY memid ORDER BY mdate) AS RowAsc,
ROW_NUMBER() OVER (PARTITION BY memid ORDER BY mdate DESC) AS...
July 2, 2019 at 3:22 pm
When doing large updates from files, I usually load the records into a staging table first, which guarantees that I have all updates loaded and nothing missing from the file. ...
May 15, 2019 at 5:15 pm
If you have a process that is adding steps, then that is the best place to maintain the records. First, update the existing current step to end the process:
May 7, 2019 at 11:42 pm
WITHAllShifts
AS(/* If the start date is before the end date, then the shift crosses a date boundary; adjust either the start or end date as needed, but...
April 28, 2019 at 9:10 pm
I keep trying to post on this thread with my solution, but the post is not being shown. If I post without code, the reply shows. I then try to...
April 25, 2019 at 6:01 pm
I see that the formatter changed two single quotes in the text to double quotes. The line that says, "SUM(CASE WHEN UnitImportDate..." should have all single quotes, not double and...
April 19, 2019 at 7:03 pm
I would normally do this job by creating a temp table, then dynamically adding and populating columns, then select the output. The advantage of that is that I can account...
April 19, 2019 at 4:29 pm
While there is probably a way to calculate all invoices and credits in a single query using recursive CTEs, I think this case is better served by using loops. ...
April 12, 2019 at 6:14 pm
"@Recipients + ‘; test_email@hp.com‘" is an expression, and expressions cannot be used when calling stored procedures. Any values you want must be set into variables before you call the...
April 4, 2019 at 8:33 pm
This is not a full solution, I know, but I made a start for you. I had a hard time understanding exactly how the sample data you provided related to...
March 22, 2019 at 9:22 am
I think what you want is to pack intervals of data. I found several articles that helped me with that challenge, which I needed to solve for working hours. Here...
March 22, 2019 at 7:21 am
You may be able to use the EXCEPT clause. Read about it here: https://www.tutorialspoint.com/sql/sql-except-clause.htm
From their explanation: "The SQL EXCEPT clause/operator is used to combine two SELECT statements and returns rows...
March 22, 2019 at 7:14 am
Option 3:WHERE T.name LIKE '%table_pattern%'
March 22, 2019 at 7:12 am
sgmunson - Thursday, March 21, 2019 10:37 AMI see a potential performance issue with the recursive CTE, which is not necessary.
Steve,...
March 21, 2019 at 10:11 pm
Seriously looks like a homework problem.
March 20, 2019 at 2:29 pm
Viewing 15 posts - 16 through 30 (of 162 total)