Viewing 15 posts - 2,761 through 2,775 (of 10,144 total)
Can you post up a sample data script please Pete? I can't see why you should have to aggregate twice. Cheers.
December 5, 2014 at 6:14 am
James.Rivers (12/3/2014)
I wanted to avoid creating a temp table for this process so I have opted to use the
SELECT LocationId, MaterialId, Duration
FROM (
SELECT LocationId,...
December 3, 2014 at 9:34 am
Andrew Kernodle (12/3/2014)
December 3, 2014 at 9:31 am
Have you tried sending the whole query to the linked server, something like this?
SELECT *
FROM OPENQUERY([mhsvi-sql2012a\instance1],
'SELECT
CONCAT(CONVERT(varchar(5),LEFT(IMADD.Postcode, 5),101)
,
''/''
,
CASE
WHEN x.Age <= 24 THEN ''A''
WHEN x.Age BETWEEN 25 AND 34 THEN...
December 3, 2014 at 6:47 am
or
SELECT LocationId, MaterialId, Duration
FROM (
SELECT LocationId, MaterialId, Duration,
VAR(Duration) OVER (partition by MaterialID) AS VarDuration
FROM #t
) d
WHERE VarDuration > 0
😉
December 3, 2014 at 6:12 am
-- Sample data
IF OBJECT_ID ('tempdb..#Locations') IS NOT NULL DROP TABLE #Locations
CREATE TABLE #Locations (LOCATIONID VARCHAR(5), MATERIALID VARCHAR(5), DURATION SMALLINT)
INSERT INTO #Locations VALUES
('PlayM', 'Clip1', 626),
('PlayB', 'Clip1', 626),
('Ing', 'Clip1', 626),
('PlayM', 'Clip2',...
December 3, 2014 at 4:51 am
andrew_dale (12/2/2014)
A person born on 2012-02-29 should be how old on 2014-02-28?
1 year old still, the day has not rolled over to 1st March
select '20120228' , FLOOR((CONVERT(INT,'20140228') - CONVERT(INT,'20120228'))/10000) ,...
December 2, 2014 at 6:22 am
dave.ott 20779 (12/2/2014)
I've always liked this to get the age in yearsselect cast(datediff(d,@dob,getdate())/365.25 as int)
Try any date pair (DOB and reference date) where the month and the day are the...
December 2, 2014 at 6:08 am
andrew_dale (12/2/2014)
December 2, 2014 at 6:01 am
Yes it is. Why not code it up as an inline table-valued function instead of a UDF? You're likely to get far better performance. Get the query to work and...
December 1, 2014 at 4:45 am
Boby B Jacob (11/27/2014)
ChrisM@Work (11/27/2014)
If you can provide some readily-consumable sample data, someone will be more likely to put together a query for you.
Hi Chris, scenario is made available by...
November 27, 2014 at 5:29 am
vignesh.ms (11/27/2014)
...1. Why scan happens before the join occurs? if it happens after join then the filter would be lighter. Even if optimizer chooses the scan to execute first....
You have...
November 27, 2014 at 5:07 am
If you can provide some readily-consumable sample data, someone will be more likely to put together a query for you.
November 27, 2014 at 4:06 am
TomThomson (11/26/2014)
Hugo Kornelis (11/26/2014)
The code in option 2 will always do two lookups. One for the EXISTS, and then another one...
November 26, 2014 at 7:23 am
skanker (11/26/2014)
I can see now from the discussion that this was testing other things - however based on just the question...
November 26, 2014 at 6:39 am
Viewing 15 posts - 2,761 through 2,775 (of 10,144 total)