Viewing 15 posts - 511 through 525 (of 2,645 total)
If you want to make it even faster you can add an index to the temporary table:
IF OBJECT_ID('tempdb..#pre_filtering') IS NOT NULL
DROP TABLE #pre_filtering;
;WITH...
February 18, 2023 at 3:46 am
Try this instead, it splits it into 2 separate statements:
IF OBJECT_ID('tempdb..#pre_filtering') IS NOT NULL
DROP TABLE #pre_filtering;
;WITH pre_filtering AS
(
SELECT...
February 18, 2023 at 3:28 am
Try this:
;WITH pre_filtering AS
(
SELECT DISTINCT
a.[DC],
...
February 18, 2023 at 2:55 am
Jonathan it is Microsoft SQL Server 2016
You asked the question in the SQL 2019 forum.
Try the code in the last comment I made.
February 18, 2023 at 2:20 am
You need a GROUP BY:
SELECT DC, UPC, stuff((select ', ' + MASTERCHAINNAME
from...
February 18, 2023 at 2:10 am
I have SSMS v18.5.1. When I tried to do it, it gave me an error namely 'STRING_AGG' is not a recognized built-in function name.
It's the version of SQL Server...
February 18, 2023 at 2:07 am
Create some test data in a consumable format (you should have done this):
DROP TABLE IF EXISTS #pre_filtering;
CREATE TABLE #pre_filtering (
DC VARCHAR(50),
...
February 18, 2023 at 2:02 am
Other thing is, SQL optimizer has not suggested any missing indexes in the actual execution plan.
We are on SQL Server 2017 EE.
You might have to rewrite the query to...
February 17, 2023 at 4:34 pm
[
Hi Jonathan,
Thanks for the inputs. I would think the last non-clustered idx is better to create. Also, I have a question on this, do we need to mention ROWID_OBJECT...
February 17, 2023 at 4:31 pm
Your query can be simplified to this:
SELECT TOP(11)
c.rowid_object,
c.creator,
...
February 17, 2023 at 11:13 am
Jonathan great. Thanks. I appreciate your help.
One more small question. This code basically compares items between ITEM/LOC and temp and returns if there is a mutual match between temp...
February 17, 2023 at 12:48 am
Jonathan AC Roberts I think yours work. Thank you.
Can I ask do you know guys what am I doing wrong?
I am trying to detect if items from the table...
February 16, 2023 at 10:53 pm
Not sure what you are trying to do but you could put the results of that query into a temp table like this:
DROP TABLE IF EXISTS #temp;
CREATE...
February 16, 2023 at 7:19 pm
And, in the process of making the primary key, it made yet another mistake (at least according to my personal standards). If it's a #TempTable, then never name the...
February 15, 2023 at 8:58 pm
Thanks for taking the time to do these experiments, Jonathan.
The reason it got the Zip right is because it's in quotes. You also had to realize its mistakes on...
February 15, 2023 at 8:54 pm
Viewing 15 posts - 511 through 525 (of 2,645 total)