Viewing 15 posts - 631 through 645 (of 754 total)
Share what you found, and help others learn.
Sooner or later ,someone else out there will be struggling with a similar problem, and your experience may help them.
August 24, 2021 at 8:43 pm
This is precisely what foreign keys are for.
Is ItemNumber in the transaction table equivalent to the ProductId in the master table?
August 19, 2021 at 10:05 pm
It's not a csv. There is no single, consistent delimiter. This is invalid json. json keys/names should be enclosed in quotes. Those that contain delimiters must be enclosed in quotes.
If this...
August 19, 2021 at 3:27 pm
Be methodical. Understand the relationships and data.
Look for obvious contradictions in the where clauses -- where StartDate > '2021-08-19' AND StartDate < '2021-08-01' will filter out everything.
Then look for typos...
August 19, 2021 at 1:22 pm
I'm guessing you meant a UDF (user-defined function) or more specifically, an ITVF (inline-table valued function) rather than a CTE, since a common table expression doesn't really seem to enhance...
August 17, 2021 at 7:20 pm
You need to wrap
(SELECT COUNT(*) FROM .[dbo].[Stage_SMSLog]
with (NOLOCK) WHERE datestamp = CONVERT(nvarchar(10), GetDate(),120))
in CAST or CONVERT when concatenating into nvarchar (or varchar) string using "+"
(CONCAT function...
August 12, 2021 at 6:06 pm
Removed inaccurate response.
August 2, 2021 at 9:48 pm
You could make the parameter that window/time range.
Obviously your underlying will have to change.
If it's always 30 days windows like your two examples suggest (is that sample really representative, or...
July 29, 2021 at 2:52 pm
So you're saying it's a good thing there isn't a BacklogUpdateTrackingTable?
🙂
July 15, 2021 at 3:58 pm
Indexed views can't reference other databases - Tables must be referenced by two-part names, schema.tablename in the view definition.
Indexed views cannot contain common table expressions.
https://www.brentozar.com/archive/2013/11/what-you-can-and-cant-do-with-indexed-views/
A couple of possible alternatives:
July 12, 2021 at 2:46 pm
You have no explicit column(s) by which the data can be you reliably ordered and grouped. You have no ID, date, or other criteria for ordering or grouping the data.
Your sample...
July 8, 2021 at 2:47 pm
Does csi_sample_specs have an index on csi_sample_id and spec_size (ideally including spec_amount if a nonclustered index)?
How slow is super slow? What is expected/needed execution time? Do other queries execute quickly?
What...
July 2, 2021 at 6:02 pm
https://www.microsoft.com/en-us/download/details.aspx?id=57474 is just the Service Pack 3 installer.
https://www.microsoft.com/en-us/download/details.aspx?id=57473 has downloads for SQL Express and other components with SP3 integrated.
You probably just need the service pack (57474).
July 2, 2021 at 1:24 pm
You're often better off using a UNION ALL to separate the cases into statements with their own sargeable where clauses -- e.g.,
SELECT ...
FROM ...
WHERE @Test = 'Yes'...
June 28, 2021 at 9:08 pm
where len(r.portionkey)=len(m.portionkey)
The functions are going to prevent SQL Server from using indexes effectively even if you had them. It also seems to indicate that portion...
June 14, 2021 at 7:20 pm
Viewing 15 posts - 631 through 645 (of 754 total)