Viewing 15 posts - 51,166 through 51,180 (of 59,098 total)
ORDER BY in an UPDATE is only possible in a subquery and then you would have to use TOP.
All that not-with-standing, I wish the OP would post some data and...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 13, 2008 at 5:53 pm
As Barry has shown, ROLLUP should do it. For more information, lookup GROUPING under CUBE in Books Online.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 13, 2008 at 5:50 pm
Dangskie (4/2/2008)
Hi. Can you help me with this? - In terms of simultaneous users access, what's more efficient, a table or a view?
An indexed view will usually blow...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 13, 2008 at 9:45 am
Ian Yates (4/13/2008)
If multiple rows in W match up with TIEWF then you could have the update happening multiple times which isn't really predicable.
Heh... why sure it is... it'll...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 13, 2008 at 9:24 am
Thanks, SQLBlue. :blush: Very happy it does what you want and I sure do appreciate the compliment... you made my weekend. 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.
April 13, 2008 at 9:18 am
Sergiy (4/12/2008)
Actually you can.Just declare your variable as a parameter of SP.
Never too late to say thanks... you showed me that cool trick a couple of years ago. Thanks...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 11:42 pm
Heh... yeah... and some generic data with a generic table structure along with your generic code and a generic sample of what the output should look like would be a...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 11:38 pm
p.s.
Longer code is not always slower code. Longer code does the ol' "Divide and Conquer". The code I posted is what they call "Set Based" programming and that...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 11:34 pm
As you're finding out, the hard part is to "smear" the existing data into the new rows for the missing years. This type of smearing is VERY procedural and...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 11:15 pm
Matt is correct about the Tally table... but a Tally table isn't really worth a hoot when it comes to performance unless you also build the necessary Clustered Primary Key......
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 10:04 pm
JD (4/12/2008)
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 9:27 pm
Heh... I've made many such a mistake... thanks for the feedback.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 9:12 pm
Sometimes, "old school" works better...
SET NOCOUNT ON
SET STATISTICS IO ON
SET STATISTICS TIME ON
SELECT IDENTITY(INT,1,1) AS RowNum,
ID,ST,Date
INTO #MyHead
...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 4:33 pm
So, what was the problem and how did you fix it?
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 2:29 pm
Like practicing the piano, either you invest the time to get really good... or you don't. There are no shortcuts. For example, I recently answered a post where...
--Jeff Moden
Change is inevitable... Change for the better is not.
April 12, 2008 at 2:03 pm
Viewing 15 posts - 51,166 through 51,180 (of 59,098 total)