Viewing 15 posts - 1 through 15 (of 1,970 total)
You could add a constraint to the table to ensure that one of the values is null and one is not null:
ALTER TABLE DieselTransaction
ADD CONSTRAINT...
August 16, 2022 at 9:48 am
You can do it in a more straight forward way using OFFSET:
DECLARE @PAGE INT = 1;
WHILE (@PAGE <= 5)
BEGIN
...
August 16, 2022 at 9:22 am
I would find having "-- (Values)" between the insert and select statements very annoying.
For me having more new lines and some decent indentation would make it a lot more maintainable.
August 15, 2022 at 6:30 pm
Why don't you want to make supplier and machine column accept null?
August 15, 2022 at 11:40 am
This was removed by the editor as SPAM
August 5, 2022 at 8:30 pm
Why can't you use CTEs?[/quote]
I want to compile a view into a third party system that does not support CTEs. If it's not possible to accomplish without CTEs I...
August 5, 2022 at 8:30 pm
If you add the LAG columns to #MyData you could try CROSS JOIN'ing the calendar rows with the distinct IDs. Then LEFT JOIN #MyData on id and date.
I...
August 5, 2022 at 8:23 pm
Drew showed me his wonderful code to do this same thing on another thread. I did a deep dive on it and the concept is wonderfully simple and it...
August 4, 2022 at 8:03 pm
Here is a comparison of the two methods:
/* Windowed Aggregate (MAX) */Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead...
August 4, 2022 at 7:39 pm
Here is a comparison of the two methods:
/* Windowed Aggregate (MAX) */Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0,...
August 4, 2022 at 6:32 pm
Instead of using LAG you can use OUTER APPLY. I've used both in this query so you can see the difference.
CREATE OR ALTER VIEW TestView AS
...
August 4, 2022 at 5:27 pm
Well, if you call this fnTally with a start value of zero (0), you get two zeros (0). You can eliminate:
SELECT N = 0 WHERE @StartN = 0 UNION...
July 30, 2022 at 9:15 pm
With a minor change to the function you could increase the functionality so that instead of specifying a bit for Zero or One for the starting value you could specify...
July 30, 2022 at 3:14 pm
Heh... lordy. That's a snoot full of code. Thanks, Jonathan.
Yes, lots of code and it's not my style of writing code so I haven't done much with it.
July 28, 2022 at 12:59 am
Yep... if they can make stuff like that clickable, why can't they make it codeable? The answer is, they can but haven't,
Yes, that would be a good enhancement to...
July 27, 2022 at 7:42 pm
Viewing 15 posts - 1 through 15 (of 1,970 total)