Viewing 15 posts - 5,716 through 5,730 (of 10,143 total)
ScottPletcher (9/5/2012)
SELECT
t1curr.cod, t1curr.[year], t1curr.[month],...
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
September 6, 2012 at 2:36 am
Looks fine to me, Tom. Thanks for the feedback.
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
September 6, 2012 at 2:27 am
bmahf (9/5/2012)
Oops, the s_difference+1 is incorrect. That should be been just s_difference. The minus is correct.
Here's a version which corrects for aTime being more recent than bTime, and...
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
September 6, 2012 at 2:18 am
This might be better than the CASE:
With MyCTE (aTime, bTime)
AS
(
SELECT convert(datetime2,'1900-01-01 00:08:00.0000001'), convert(datetime2,'1900-01-01 00:09:18.361')
UNION ALL SELECT '1900-01-01 00:08:00.0000001', '1900-01-01 00:13:50.705'
UNION ALL SELECT '1900-01-01 00:09:18.361', '1900-01-01 03:13:50.7050001'
...
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
September 5, 2012 at 9:55 am
vinay.varaala (9/5/2012)
getdate()-- current date
my question I want the records from beginning of previous month to today ..wats...
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
September 5, 2012 at 9:40 am
vinay.varaala (9/5/2012)
thanks got the error. cheers..one more question i want to select a record of 2012-05-20 date how to teh code for dateadd()
This is far too vague. What are you...
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
September 5, 2012 at 9:29 am
SQL Kiwi (9/4/2012)
Blog post is up: http://bit.ly/ComputeScalar
"Deferred execution" - the next best thing to "Let off the hook" 😀
Thanks for an excellent read, Paul.
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
September 5, 2012 at 8:16 am
Tricky but not impossible: this is just a proof of concept.
With MyCTE (TheTime)
AS
(
SELECT convert(datetime2,'1900-01-01 0:08:00.0000001') UNION ALL
SELECT '1900-01-01 0:09:18.361' UNION ALL
SELECT '1900-01-01 0:13:50.705'
)
SELECT
*,
CAST(f.q AS...
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
September 5, 2012 at 7:39 am
nzhang6666 (9/5/2012)
I got following error when compiling --1 (commented --2 and --3).Incorrect syntax near '('.
Are you testing on SQL server 2005?
It's probably the missing batch separator "GO" after 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
September 5, 2012 at 6:23 am
woody_rd (9/5/2012)
a timestamp, eventid...
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
September 5, 2012 at 6:09 am
Lowell (9/5/2012)
except for the missing GO statement between the end of the proc and the DECLARE, when i uncomment #2, all three work perfectly.
Same here. I wonder what the secret...
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
September 5, 2012 at 6:04 am
subbareddy542 (9/5/2012)
use below code:...
After correcting [val].
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
September 5, 2012 at 5:51 am
Koen's nailed all the good reasons for not persisting this information. It's easy enough to calculate on the fly:
-- This running total uses a triangular join.
-- The performance of TJ's...
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
September 5, 2012 at 5:44 am
ChrisM@Work (9/4/2012)
farooq.hbs (9/4/2012)
...Hoping will get the Solution for this
Thanks
Of course - but you will get a solution much quicker if you can set up DDL and DML for some sample...
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
September 5, 2012 at 3:52 am
Mitesh Oswal (9/4/2012)
Farooq,Can you please verify the below code. Looks better performance...
Very interesting. Can you post the test script which you used for the comparison?
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
September 4, 2012 at 9:32 am
Viewing 15 posts - 5,716 through 5,730 (of 10,143 total)