Viewing 15 posts - 1,291 through 1,305 (of 7,608 total)
How is the orders table clustered? I'm guessing by orderid.
But, for this query, since jobdatestart is the key restrictor on the number of rows, that would make a better clustering...
September 1, 2021 at 3:39 pm
The '+/- #n' offset parameter only works (afaik) with the GETDATE() function and not literal values
I believe the +/- n days works with any datetime value. I 'm...
September 1, 2021 at 3:27 pm
Do you have the latest CU applied? That condition is often a bug in SQL code, fixed by maintenance.
September 1, 2021 at 2:40 pm
You don't need to shrink the database, but you do need shrink the affected file(s). NEVER shrink a database, only file(s).
Run:
DBCC SHOWFILESTATS
and find the FileId(s) with lots of free space. ...
September 1, 2021 at 11:28 am
I think maybe you can just change the CROSS APPLY in Steve's code?!:
...
cross apply (values (cast(w.CREATE_DATE as datetime)+
...
August 31, 2021 at 9:32 pm
(1) Cluster the main table on ID: a nonclus index is worthless here.
(2) Cluster the lookup table on ID. The join of the two tables should now become a MERGE...
August 31, 2021 at 8:35 pm
Sure, you can do that. But I can't really follow the logic of the the original statement -- particularly the logic of starting from a negative starting byte, so I...
August 31, 2021 at 8:30 pm
Sorry, I left out a step.
dbo.DelimitedSplit8k is a function commonly used on this site to efficiently split a string into multiple parts based on a single-character delimiter.
Here's a version of...
August 31, 2021 at 3:42 pm
SELECT PERSONNUM,ORGPATHTXT,LOC
FROM SampleData2
CROSS APPLY (
SELECT TOP (1) LOC
FROM (
...
August 31, 2021 at 7:21 am
I believe SQL caches table variables the same way it does for temp tables. If so, an entries for them would still be in the system tables. It would be...
August 30, 2021 at 6:37 pm
For the actual tables, post the DDL, including all indexes.
For any views, post the view definition.
August 29, 2021 at 7:04 am
Agree, there's no super-easy, "automatic" way to do that. However, you can generate a script(s) that will change each column as needed, so it's not like you have to do...
August 27, 2021 at 3:18 pm
To allow me to write full code, would you provide the full DDL for the Error_Log table? The big gain will come from encoding strings as numbers using a conversion...
August 27, 2021 at 7:15 am
Of course it's optional if you make the new clustering index a PK or not.
That is, you could drop the existing PK, create the new clustering index, then re-add the...
August 26, 2021 at 9:00 pm
Get rid of the functions around the usrt_dtm_DateTime column; you don't need them and they will prevent lookup seeks, drastically harming performance:
SET @ToDate = CAST(@ToDate AS date)...
August 26, 2021 at 8:53 pm
Viewing 15 posts - 1,291 through 1,305 (of 7,608 total)