Viewing 15 posts - 481 through 495 (of 3,480 total)
Post the CREATE TABLE scripts and someone can help you. =)
September 10, 2021 at 2:12 am
Great! Could you post the solution you came up with?
September 9, 2021 at 5:15 pm
I'm no expert, but you have to unravel SQL from the innermost queries to the outermost.
is there a shortcut? Not that I know of. I'd love to be proven wrong,...
September 8, 2021 at 8:13 pm
Your data is a bit wonky, but maybe something along these lines?
SELECT meshtype,
[datetime] as stamp,
tonsProduced,
theDate = CAST([datetime] AS DATE),
theTime = CAST([datetime] AS TIME)
-- fv = first_value([datetime]) OVER (PARTITION BY meshtype...
September 8, 2021 at 8:12 pm
Normalization 101 time, I think. that's a LOT of repeating fields (any time I see a column name with a number at the end, I'm immediately suspect).
Is this supposed to...
September 7, 2021 at 7:18 pm
This looks like it's supposed to be looking for the @current_proc_name value, not the literal string 'SOURCE', but then WTH do I know?
AND CHARINDEX('ALTER', @proc_source) < CHARINDEX('SOURCE',... September 7, 2021 at 6:38 am
So what do you do then? Use XE to determine which queries are run and how often to determine whether the workload improves or not with the new indexing?
September 7, 2021 at 12:13 am
Create a unique index on all the columns and make that unique?
September 6, 2021 at 11:57 pm
Multiply the result of your sum by 1.000 (adjust the number of zeroes as needed), and it will be converted to a decimal.
August 31, 2021 at 2:09 pm
use datediff and calc full days first, then subtract, then repeat for hours, and then minutes?
August 30, 2021 at 5:11 am
FWIW, here's the worked solution, so folks at home can play along...
use tempdb;
go
/* setup script */CREATE TABLE LineItem(
LineNum int not null,
ItemNo char not null,
Qty tinyint not null);
GO
INSERT...
August 27, 2021 at 3:46 pm
right-click on the table, and "script table as"... then "Create to..."?
August 24, 2021 at 5:04 pm
SELECT ...
FROM query1
UNION ALL
SELECT...
FROM query2
August 24, 2021 at 3:21 pm
If they're dates, use something like >= @StartDate AND < @EndDate.
No need to do all that expensive conversion.
August 17, 2021 at 9:59 pm
use a windowing function with SUM and UNBOUNDED PRECEDING.
August 17, 2021 at 6:13 pm
Viewing 15 posts - 481 through 495 (of 3,480 total)