Viewing 15 posts - 1,141 through 1,155 (of 7,616 total)
SELECT
[Shelf Location], date /*, ...*/
FROM (
SELECT *, DENSE_RANK() OVER(PARTITION BY [Shelf Location] ORDER BY date DESC) AS rank_num
...
November 17, 2021 at 7:58 pm
I see no way to accurately parse that data will all the variations presented (and any number even worse than that that could happen).
November 17, 2021 at 4:46 pm
If ID is (nearly) always an identity column, you can use ORDER BY $IDENTITY, that way you don't need to know the exact column name.
November 15, 2021 at 2:53 pm
As a bit of a sidebar, wouldn't adding more files add to the problem you spoke of previously?
I'm not sure which specific "problem" you're referring...
November 9, 2021 at 7:03 pm
It actually does explain it. If SQL has to do a sort to get the rows in the correct order, then the cursor would be required to do a sort...
November 9, 2021 at 5:38 pm
Sorry to have bothered you then. Good luck with this. (I believe if you changed your cursor to LOCAL FAST_FORWARD (as in standard in SQL Server unless you explicitly need...
November 9, 2021 at 5:31 pm
You should change the index so that it has the proper sort order already, which will (should) avoid the sort in the query:
CREATE NONCLUSTERED INDEX [IX_ImageProduct_MID] ON...
November 9, 2021 at 5:09 pm
Jeff Moden wrote:As a bit of a sidebar, wouldn't adding more files add to the problem you spoke of previously?
I'm not sure which specific "problem" you're referring to.
The one...
November 8, 2021 at 3:45 pm
This is not going to allow index usage in the join: AND KeyValue = (co.co_num + '-' + CAST(coitem.co_line AS VARCHAR(10)) + '-0' )
SQL can use an index for...
November 6, 2021 at 5:03 am
fake_pointer ???? NOT NULL);
The reason you are using big integers is because they look like pointers. But we don’t use pointers in RDBMS. You’re using SQL to write assembly...
November 6, 2021 at 4:59 am
As a bit of a sidebar, wouldn't adding more files add to the problem you spoke of previously?
I'm not sure which specific "problem" you're referring to.
November 6, 2021 at 4:52 am
But when Jonathon added both columns the WHERE clause, it might have taken care of it.
c.CustomerNumber = t.CustomerNumber AND c.Customer = t.Customer
Jonathon, your second query brought the spool back. ...
November 5, 2021 at 4:29 pm
Agreed, the NOLOCK was already on my radar.
Removing NOLOCK would only slow down the process, never speed it up. I'm not saying you should or shouldn't use it here...
November 5, 2021 at 3:16 pm
I don't understand what you are trying to do or your data. But I think the part:
Bank = (Select Bank From Customer Where Customer=t.Customer)is redundant.
I'm not...
November 5, 2021 at 3:14 pm
What indexes do you have on that table?
Looks like an index on ( MessageType, NewValue, KeyValue, RecordDate ) INCLUDE ( CreateDate, OldValue )
might be useful for this query.
November 5, 2021 at 2:54 pm
Viewing 15 posts - 1,141 through 1,155 (of 7,616 total)