Viewing 15 posts - 4,576 through 4,590 (of 5,393 total)
You probably need to keep the streets together. Try adding street in the order by in 2nd position:
select *
from @jobs
order by max(seq) over (partition by street) desc, street, seq...
-- Gianluca Sartori
February 22, 2010 at 2:55 am
To understand the query you just have to add the order by column to the select list:
select *, max(seq) over (partition by street) as maxseq
from @jobs
This returns the max sequence,...
-- Gianluca Sartori
February 22, 2010 at 2:44 am
select * from @jobs
order by max(seq) over (partition by street) desc, seq desc
Hope this helps
Gianluca
-- Gianluca Sartori
February 22, 2010 at 2:20 am
This should do the trick. There must be some quicker way, but for a one time search it should work.
DECLARE @searchString varchar(100)
DECLARE @searchStringEscaped varchar(100)
SELECT @searchString = ' XYZ_',
@searchStringEscaped = '%...
-- Gianluca Sartori
February 22, 2010 at 2:06 am
You can do it yourself: https://www.sqlservercentral.com/MyAccount
-- Gianluca Sartori
February 22, 2010 at 1:41 am
Thanks Gus. I'll be sure to test it, obviously.
I read on a quite old article that partitioning makes reads worse, but improves writes. Is it true in your experience?
Also, will...
-- Gianluca Sartori
February 18, 2010 at 11:32 am
GilaMonster (2/18/2010)
Some threads lately there's been so much conflicting advice from various people that it's hard to get useful...
-- Gianluca Sartori
February 18, 2010 at 9:49 am
jcrawf02 (2/18/2010)
Grant Fritchey (2/18/2010)
-- Gianluca Sartori
February 18, 2010 at 9:42 am
Duplicate post, deleted
-- Gianluca Sartori
February 18, 2010 at 4:19 am
GilaMonster (2/18/2010)
Gianluca Sartori (2/18/2010)
In that particular case, with the identity column as primary key clustered, yes, doesn't it?
Logical order of the index - yes
Physical order of the data - no
Order...
-- Gianluca Sartori
February 18, 2010 at 4:19 am
Dave Ballantyne (2/18/2010)
Does anyone else read this responsehttp://www.sqlservercentral.com/Forums/FindPost867131.aspx
as implying that using a identity defines order ?
In that particular case, with the identity column as primary key clustered, yes, doesn't...
-- Gianluca Sartori
February 18, 2010 at 2:24 am
It could be a date format issue. Your code is also prone to sql injection, use prepared statements instead.
Put @parameter placeholders in your sql, then add parameter values to your...
-- Gianluca Sartori
February 18, 2010 at 2:05 am
Looks like somebody can't stay away from corruption threads...
http://www.sqlservercentral.com/Forums/FindPost867727.aspx
I foresee SSIS being mentioned 😀
-- Gianluca Sartori
February 18, 2010 at 2:01 am
It's hard to tune a query without table definition scripts and indexes.
That said, you could try to get rid of one of the outer joins in your view:
CREATE VIEW [dbo].[viMostRecentPatientEvent]
AS
SELECT...
-- Gianluca Sartori
February 16, 2010 at 2:26 am
Most of the query cost seems to be in the Key Lookup for DocDataField.FieldValueDateTime in the last outer join in the view.
Try adding a covering index to avoid the lookup.
I...
-- Gianluca Sartori
February 11, 2010 at 10:19 am
Viewing 15 posts - 4,576 through 4,590 (of 5,393 total)