Viewing 15 posts - 3,031 through 3,045 (of 10,144 total)
Koen Verbeeck (8/15/2014)
GilaMonster (8/15/2014)
Eirikur Eiriksson (8/14/2014)
You can try out these methods as previously suggested
However OP said
I really don't like this temp table creation
So, no row number, no temp tables....
August 15, 2014 at 4:29 am
Thanks Steve. Something along these lines then. Not sure where two of the tables (MG_COUNTRY,MG_OFFICE) fit into this but it's worth a try:
SELECT *
INTO #Offices
FROM (VALUES
('KBE ANR','BELGIUM'),('KBE ZEE','BELGIUM'),('KEU...
August 15, 2014 at 2:20 am
TomThomson (8/14/2014)
ChrisM@Work (8/14/2014)
A little further south in the Thames Valley, this is the best summer we've had for six or seven years.
The same here - Cheshire is not famous...
August 15, 2014 at 2:07 am
This is worth a try:
SELECT *
INTO #Offices
FROM (VALUES
('KBE ANR','BELGIUM'),('KBE ZEE','BELGIUM'),('KEU ANR','BELGIUM'),
('KDE VIE','AUSTRIA'),
('KDE BRE','GERMANY'),('KDE BRV','GERMANY'),('KDE DUS','GERMANY'),('KDE FRA','GERMANY'),('KDE HAM','GERMANY'),('KDE MUC','GERMANY'),('KDE STR','GERMANY'),
('KFR BOD','FRANCE'),('KFR DKK','FRANCE'),('KFR FOS','FRANCE'),('KFR LEH','FRANCE'),('KFR LIO','FRANCE'),('KFR MRS','FRANCE'),
('KFR PAR','FRANCE'),('EXAF PARIS','FRANCE'),('FRBAL BOD','FRANCE'),('KEU...
August 14, 2014 at 9:51 am
;WITH Dates AS (
SELECT [date]
FROM (VALUES
(GETDATE()-7.7),(GETDATE()-6.6),(GETDATE()-5.5),(GETDATE()-4.4),(GETDATE()-3.3),
(GETDATE()-2.2),(GETDATE()-1.1),(GETDATE()-0),(GETDATE()+1.1),(GETDATE()+2.2),
(GETDATE()+3.3),(GETDATE()+4.4),(GETDATE()+5.5),(GETDATE()+6.6),(GETDATE()+7.7)
) d ([date])
)
SELECT
[date],
[Dayname] = DATENAME(dw, [date]),
LatestSunday = DATEADD(DAY,-1+DATEDIFF(DAY,-1,[date])/7*7,0),
LatestMonday = DATEADD(DAY,DATEDIFF(DAY,0,[date])/7*7,0),
LatestTuesday = DATEADD(DAY,1+DATEDIFF(DAY,1,[date])/7*7,0)
FROM Dates
August 14, 2014 at 7:26 am
Shadab Shah (8/6/2014)
Since yesterday i am trying to improvised on the solution given by you.
Actually there is one more condition , Consider the...
August 14, 2014 at 3:06 am
TomThomson (8/13/2014)
GilaMonster (8/13/2014)
TomThomson (8/13/2014)
GilaMonster (8/12/2014)
I'd love some rain. It's getting towards the end of winter here and it is soooo dry.
I wish I could give you some of ours. ...
August 14, 2014 at 2:20 am
pwalter83 (8/13/2014)
ChrisM@home (8/8/2014)
pwalter83 (8/8/2014)
ChrisM@Work (8/7/2014)
I don't see any parameters in your code, Paul.
Any ideas, Chris ??[/quote
Hi Paul, I'm on break in Normandy with no access to SQL Server until tuesday....
August 14, 2014 at 2:16 am
Vimal Lohani (8/13/2014)
Thanks ChrisM@Work for your comment. I got the tone.Generally UDFs are slow as compare to same query.
You may also wish to correct the error. Your function returns...
August 13, 2014 at 8:40 am
Phil Parkin (8/13/2014)
Alan.B (8/12/2014)
If I understand your question correctly you need to do what is referred to as a Left Anti Join Semi Join.
Not by me! Or anyone else,...
August 13, 2014 at 5:12 am
-- Your function returns incorrect values when the time of the from-date is later than the time of the to-date.
-- Also, it's likely to be far faster written as an...
August 13, 2014 at 4:17 am
SELECT
e1.Place,
e1.Objective,
e1.[Year],
e1.[Month],
e1.Exam1,
e2.Exam2,
e3.Exam3
FROM #tmpExam1 e1
LEFT JOIN #tmpExam2 e2
ON e2.Place = e1.Place
AND e2.[Year] = e1.[Year]
AND e2.Objective = e1.Objective
AND e2.[Month] = e2.[Month]
INNER JOIN #tmpExam3 e3
ON e3.Place...
August 12, 2014 at 5:39 am
rajsin7786 (8/11/2014)
thanks for all your help, i have updated statistics on all the columns, I ran the query suggested by ChrisM and also the original query , both...
August 12, 2014 at 2:01 am
ScottPletcher (8/7/2014)
ChrisM@Work (8/7/2014)
gstarsaini (8/7/2014)
Thanks for the reply.This means there is no effect on the queries?
Each reply posted to your question implies "maybe", "probably" or "definitely". The average of these isn't...
August 7, 2014 at 9:19 am
I don't see any parameters in your code, Paul.
August 7, 2014 at 8:58 am
Viewing 15 posts - 3,031 through 3,045 (of 10,144 total)