Viewing 15 posts - 661 through 675 (of 7,597 total)
Does that take care of the whole "season" of dates the OP identified
I need to create a query where the first of March will be Week 1...
August 26, 2022 at 3:27 pm
No need to overly complicate this. Just calc the starting Monday date, then determine week# displaced off that "base" date.
I moved the time adjustment into a CROSS APPLY only so...
August 25, 2022 at 6:14 pm
Either method will work.
Personally I prefer using the TimeTaken column. Triggers with transactions can be used to ensure that the times are kept in sync. Of course you'd want a...
August 23, 2022 at 1:50 pm
No. For an explicit transaction, you need an explicit COMMIT or ROLLBACK.
August 18, 2022 at 7:08 pm
SELECT
CoName,
MAX(CASE WHEN Class = 'aaa' THEN 'Yes' ELSE '' END) AS aaa,
MAX(CASE WHEN Class...
August 18, 2022 at 7:07 pm
I need single row per invoicenumber
Yet you're showing two lines of output for the same invoice number??
August 18, 2022 at 5:07 pm
Put comments inside the code, not before it.
frederico_fonseca stated why:
(1) it's a royal pain trying to make automated changes if comments precede the CREATE / ALTER
(2) it's odd to consider code...
August 18, 2022 at 2:36 pm
It sounds like maybe you need to make this adjustment to the code?:
...
WHERE g.Year = @year and g.Month = @month AND g.FailureCount <> 0
...
August 18, 2022 at 2:25 pm
Are you exec'ing the code from a different db with a lower compatibility?
This really looks like a compatibility issue. Check the compatibility level of all dbs on that instance.
August 18, 2022 at 2:18 pm
There are some that are a negative number
That seems logical, if it went from 1 to 0, the change would be -1.
display the Largest positive number first.
Could you explain this...
August 17, 2022 at 4:41 pm
If I understand the problem correctly, I think all you need is a standard LAG. You may need to adjust the PARTITIONing columns and/or the ORDER BY:
DECLARE...
August 17, 2022 at 2:21 pm
If you can get rid of the DISTINCT, you can do as below. If not, let me know and I will adjust code to work around the DISTINCT.
August 17, 2022 at 2:02 pm
SELECT
MIN(Emp_code) + CASE WHEN COUNT(*) > 1 THEN '_' + MAX(Emp_code) ELSE '' END AS Emp_code,
MAX(Employee_Name) AS Employee_Name,
...
August 17, 2022 at 1:47 pm
Put the conditions in a separate table. Then use a JOIN to UPDATE the original table based on the matching condition, or the first matching condition if multiple conditions could...
August 17, 2022 at 1:38 pm
I recommend using another db -- let's call it the "history_db" -- to hold the prior months' data. As each month passes, you move its table to the history_db. Also,...
August 16, 2022 at 2:01 pm
Viewing 15 posts - 661 through 675 (of 7,597 total)