Viewing 15 posts - 4,516 through 4,530 (of 10,143 total)
ssurekha2000 (6/12/2013)
not fully understoodusing the above i am not getting any records
but in query analyser i get 100 records with date condition & id condition
Please provide more detail. Your query...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 4:23 am
-- use APPLY to evaluate your filters
SELECT *
FROM table1
CROSS APPLY (
SELECT
Filter1 = CASE
WHEN @con = 0 AND YEARMONTH >= REPLACE(@YearMonth,'-','') THEN 1
WHEN YEARMONTH <>...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 2:00 am
Substitute each reference to the temp table #records with the actual query used to generate the temp table, then eliminate unnecessary table references. This takes you back to a "raw"...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 11, 2013 at 2:14 am
STUFF() works nicely too:
SELECT
PhoneNumber,
REPLACE(PhoneNumber,LEFT(PhoneNumber,5),''),
STUFF(PhoneNumber,1,5,'')
FROM (
SELECT PhoneNumber = CAST('(999)4746641' AS VARCHAR(15)) UNION ALL
SELECT '(718)4746641'
) d
WHERE LEFT(PhoneNumber,5) = '(999)'
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 10, 2013 at 5:31 am
Alexander Suprun (6/7/2013)
ChrisM@Work (6/7/2013)
UPDATE D SET
Track_ID = P.Track_ID,
Territory_ID = P.Territory_ID,
Major = P.Major
FROM Staging.Track_Play D
INNER JOIN Staging.Track_Mapping P
ON P.ISRC =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 10, 2013 at 1:20 am
Something like this can help, and it's easy to check;
UPDATE D SET
Track_ID = P.Track_ID,
Territory_ID = P.Territory_ID,
Major = P.Major
FROM Staging.Track_Play D
INNER JOIN Staging.Track_Mapping P
ON P.ISRC = D.ISRC_Code
AND P.Event_Date =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 7, 2013 at 7:25 am
You might consider something like this too:
DECLARE @TaskID INT
UPDATE TaskTable SET
TaskStatus = 2,
TaskOwner = @user-id,
Assigned = 1, -- don't forget
@TaskID = TaskID -- collect TaskID for client
WHERE TaskID =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 7, 2013 at 6:52 am
Sean Lange (6/6/2013)
... In lieu of using a permanent table I use a view that creates the tally table on the fly. 0 reads to access it and I don't...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 7, 2013 at 1:05 am
SELECT
sh.ServicerHistoryId,
shrc.CommissionRate
FROM dbo.ServicerHistory sh
OUTER APPLY (
SELECT
d.CommissionRate
FROM (
SELECT
ishrc.CommissionRate,
RowNum = ROW_NUMBER() OVER (PARTITION BY ServicerHistoryID ORDER BY EffectiveDate DESC)
FROM dbo.ServicerHistoryCommissionRate ishrc
WHERE ishrc = ServicerHistoryID = sh.ServicerHistoryID
) d
WHERE d.Rownum = 1
)...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 6, 2013 at 9:31 am
Matthew Darwin (6/6/2013)
...Any tips, pointers or observations are most welcome!
Have you tried using the row_number method with the outer apply so you have an even playing field?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 6, 2013 at 9:24 am
A long time ago in a galaxy far, far away a bunch of folks were arguing about an exotic and rarely-mentioned internal feature of SQL Server for Pangaians 238857. The...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 6, 2013 at 9:02 am
jconaty54 (6/6/2013)
Year, Jan, Feb, Mar, Apr, May,June, July, Aug, etc...
The report calls for the month selected plus 3 months back. This...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 6, 2013 at 8:30 am
rodjkidd (6/6/2013)
I'm flying up tonight. Looks like the weather will be good - even though I'll be indoors most of the time!...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 6, 2013 at 7:28 am
Are you the adminstrator of the SQL server instance, Mike?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 6, 2013 at 6:36 am
Mark-101232 (6/6/2013)
... and identical solutions too!
Must be correct then!
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 6, 2013 at 6:33 am
Viewing 15 posts - 4,516 through 4,530 (of 10,143 total)