473,396 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ORIGINAL SIN IN SQL 2005!

from the December 2004 _Redmond Magazine_, "Finding Gold in Yukon":
http://redmondmag.com/columns/articl...itorialsID=838

"Developers will also pick up the usual new-version enhancements to T-SQL,
including error handling, recursive queries, a ROW_NUMBER function, a PIVOT
relational operator and more."

ROW_NUMBER???? What possible purpose could that have???
Jul 23 '05 #1
5 1405

"Ross Presser" <rp******@imtek.com> wrote in message
news:12***************@rpresser.invalid...
from the December 2004 _Redmond Magazine_, "Finding Gold in Yukon":
http://redmondmag.com/columns/articl...itorialsID=838

"Developers will also pick up the usual new-version enhancements to T-SQL,
including error handling, recursive queries, a ROW_NUMBER function, a
PIVOT
relational operator and more."

ROW_NUMBER???? What possible purpose could that have???


http://www.winnetmag.com/Article/Art...302/42302.html

Simon
Jul 23 '05 #2
Ross Presser wrote:
from the December 2004 _Redmond Magazine_, "Finding Gold in Yukon":
http://redmondmag.com/columns/articl...itorialsID=838

"Developers will also pick up the usual new-version enhancements to T-SQL,
including error handling, recursive queries, a ROW_NUMBER function, a PIVOT
relational operator and more."

ROW_NUMBER???? What possible purpose could that have???

If it is what I think it is it's GOOD not BAD(tm):

SELECT ROW_NUMBER() OVER (ORDER BY salary PARTITION BY deptid), name, deptid
FROM employee

Returns a list of employees ranked by salary per department.
This is not to be confused with "rowid" or "rownum"
This OLAP function is part of ANSI SQL. (SQL99 I think)

Cheers
Serge
Jul 23 '05 #3
On Tue, 04 Jan 2005 15:24:59 -0500, Serge Rielau wrote:
Ross Presser wrote:
from the December 2004 _Redmond Magazine_, "Finding Gold in Yukon":
http://redmondmag.com/columns/articl...itorialsID=838

"Developers will also pick up the usual new-version enhancements to T-SQL,
including error handling, recursive queries, a ROW_NUMBER function, a PIVOT
relational operator and more."

ROW_NUMBER???? What possible purpose could that have???

If it is what I think it is it's GOOD not BAD(tm):

SELECT ROW_NUMBER() OVER (ORDER BY salary PARTITION BY deptid), name, deptid
FROM employee

Returns a list of employees ranked by salary per department.
This is not to be confused with "rowid" or "rownum"
This OLAP function is part of ANSI SQL. (SQL99 I think)

Cheers
Serge


Whew ... I'm somewhat mollified, knowing that it's part of a group of OLAP
functions. It seems like it's kind of shimming a client-oriented
preprocessor between the real client and the relational database. I guess I
can buy into that.

I thought they were just pasting in a rownum type of function that had a
relationship to the physical table, just because people were agitating for
it.

That said, I can visualize bad programmers using OLAP functions as a crutch
for bad code ...
Jul 23 '05 #4
Ross Presser wrote:
On Tue, 04 Jan 2005 15:24:59 -0500, Serge Rielau wrote:

Ross Presser wrote:
from the December 2004 _Redmond Magazine_, "Finding Gold in Yukon":
http://redmondmag.com/columns/articl...itorialsID=838

"Developers will also pick up the usual new-version enhancements to T-SQL,
including error handling, recursive queries, a ROW_NUMBER function, a PIVOT
relational operator and more."

ROW_NUMBER???? What possible purpose could that have???


If it is what I think it is it's GOOD not BAD(tm):

SELECT ROW_NUMBER() OVER (ORDER BY salary PARTITION BY deptid), name, deptid
FROM employee

Returns a list of employees ranked by salary per department.
This is not to be confused with "rowid" or "rownum"
This OLAP function is part of ANSI SQL. (SQL99 I think)

Cheers
Serge

Whew ... I'm somewhat mollified, knowing that it's part of a group of OLAP
functions. It seems like it's kind of shimming a client-oriented
preprocessor between the real client and the relational database. I guess I
can buy into that.

I thought they were just pasting in a rownum type of function that had a
relationship to the physical table, just because people were agitating for
it.

That said, I can visualize bad programmers using OLAP functions as a crutch
for bad code ...

Not all. It is a lot easier for the relational engine to do OLAP than to
put it on the client or anything inbetween. Things get really
interesting when you start looking at windowing. Like the average stock
price over a week's period.
Let's assume
stock(symbol, date, price, primary key (symbol, price))

select symbol, date, price, avg(price) over(partition by symbol order by
date rows between 3 preceding and 3 following) as avg price from stock
order by symbol, date;

All this can be done with done with either an index scan (with row
fetch) or one sort over a table scan buffering 7 rows in the pipeline.

Cheers
Serge
Jul 23 '05 #5
Error handling was part of SQL/PSM.

The WITH operator is part of SQL-99. The recursive part can be done
better with other methods in most cases. But WITH is very handy for
"creating a VIEW on the fly" and using it by name in several places

ROW_NUMBER is part of the SQL-99 OLAP extensions. Oracle and IBM
pushed the syntax in ANSI You can add an OVER() clause to the
aggregate functions give you results over a limited range of rows.
This is a way to number things within a sub-grouping. The OLAP stuff
can also be written in truly horrible SQL-92. The advantage is a
shorthand and the ability of the compiler to take advantage of an
architecture based on a contigous physical file model of storage and
access.
I'd have to look up PIVOT (why not use CROSSTABS, like we have for the
past 250 years?), but that might be pure Microsoft.

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jeff Winkler | last post by:
I've come up with a trigraph idiom, am curious if it's been done before (probably). I like to use trigraphs occasionally. Scenario: I'm doing an RSS->Javascript conversion for our intranet. I'd...
2
by: karunakar | last post by:
Hi All When will get .NET 2005 original version Regards, Karun
4
by: Prem | last post by:
I would like to reinstall the enterprise manager of sql server 2000, and i have currently sql server 2000 SP4 installed on it. I googled on it, and read that installation of enterprise manager is...
0
by: ABC | last post by:
Now i am using VB 2005, I use bindingsource,bindnavigator,tableadapter to display the database in the grid. When I choose ADD button, I can see my new row data I input, but when I choose SAVE,stop...
1
by: ShailendraPune | last post by:
I have one db test with one .mdf and .ldf file. ..mdf file size is 100mb and for some reson i removed all the tables from that .mdf file and transfer it into new secondary file so all the tables...
6
by: =?Utf-8?B?VGVycnk=?= | last post by:
When I asked this question before, don't think I was showing up as an MSDN subscriber, so I hope that is fixed now. I am a newbe here and am working through some books on using ADO.Net. These...
0
hunnicutt
by: hunnicutt | last post by:
I want to be able to click on the save icon and have the data on the form save to the original database. Right now I seem to have a disconnected dataset I have tried to change everything from read...
3
by: watashi | last post by:
Hello, I have 3 things to consider here, one is source image, form and picture box. My picture or image on the form must be proportional in size to the original image.This image on form...
1
by: Tim | last post by:
Folks, I have 3 loosely linked problems which I am would appreciate feedback on. 1). T-Sql and Active directory roles. We want to be able to control access to data within a table based on a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.