Viewing 15 posts - 8,236 through 8,250 (of 10,143 total)
Craig, you can check the values of the variables:
DECLARE @startDate datetime;
DECLARE @enddate datetime;
SET @startDate = dateadd(year, -8, dateadd(day, datediff(day, 0, getdate()), 0));
SET @endDate = dateadd(year, -1, dateadd(day, datediff(day, 0, getdate()),...
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
January 14, 2010 at 5:30 am
Abhijeet Dighe (1/14/2010)
I want it for storing transaction no.I think it will be better to check in database for uniqueness.
Transaction no.? As in named transactions?
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
January 14, 2010 at 4:24 am
Abhijeet Dighe (1/14/2010)
Thanks.But if I take only 10 characters of string generated using newid() like this:
select CONVERT(varchar(10), right(newid(),10))
still will it generate unique string?
It depends upon the scope of your requirement....
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
January 14, 2010 at 3:49 am
Abhijeet Dighe (1/13/2010)
HiSo, newid() function only generates random no.
Will I have to check for its uniqueness?
According to BOL, NEWID() "Creates a unique value of type uniqueidentifier."
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
January 14, 2010 at 2:40 am
Greg Edwards-268690 (1/13/2010)
Grant Fritchey (1/13/2010)
Steve Jones - Editor (1/13/2010)
Grant,I didn't think it was that bad, but when it doubt, doesn't hurt to apologize.
Yep. I agree. As soon as it was...
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
January 14, 2010 at 2:05 am
ifila (1/13/2010)
Lynn Pettis (1/13/2010)
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
January 13, 2010 at 9:31 am
Using 2005, pulling relevant rows from the linked server into a #temp table can dramatically improve performance.
SELECT key, name
INTO #Remote
FROM serverA.dbname.dbo.tablename
UPDATE FROM with a JOIN can be unpredictable if...
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
January 13, 2010 at 7:36 am
glen.wass (1/13/2010)
i have worked out a method for doing this now,
Step 1 create table with all my results in it, 2 create update table
step 3 create cursor to insert...
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
January 13, 2010 at 6:28 am
Here are two queries which will do the trick.
Both use a tally table to transform the segments within the column into rows, then use a GROUP BY
to dedupe. To...
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
January 13, 2010 at 6:18 am
Paul White (1/13/2010)
ifila (1/12/2010)
I did get a couple of suggestions.I bet you did :laugh:
ROFL! <<unprintable>> 😀
Thanks Paul, that made the long slog into work through the snow very worthwhile!
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
January 13, 2010 at 2:26 am
nialltuohy (1/12/2010)
Thanks, i know it does but i have one small problem, i also need the savings to be split into 4 columns, for example a policy savings column, building_savings,...
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
January 12, 2010 at 9:54 am
nialltuohy (1/12/2010)
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
January 12, 2010 at 9:03 am
Something like this?
/** Getting Total Savings per Policy*/
Select 'Policy' AS Sector,
subpolicy_name,
'' AS building_name,
'' AS floor_name,
'' AS room_name,
SUM(CO2_savings) As total_savings
From #CO2temp
group by subpolicy_name
UNION ALL
/** Getting Total Savings per...
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
January 12, 2010 at 8:07 am
José.Cruz (1/12/2010)
The problem is that the description field is diferente, for instance for machine topdubctx02 you get 2 rows in the result:
TestDate description machname
---------------------------------------------------------------------------------------------
2010-01-07 18:07:45.000 AV Status: Up-to-date 07/01/2010 18:04:29...
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
January 12, 2010 at 7:09 am
Spikemarks, is it possible to determine what you want to do from these two posts? I don't think so! How about showing two output lists, one containing what you currently...
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
January 12, 2010 at 6:55 am
Viewing 15 posts - 8,236 through 8,250 (of 10,143 total)