The Real SQL Server Experts

  • Lynn Pettis (5/26/2009)


    Damus (5/26/2009)


    I withdraw all comments I previously posted on this discussion.

    I appologize to anyone who was offended. Did not mean anything wrong.

    Peace (white flag)

    I wasn't offended. I am curious what you think is wrong with the SQL (or in this case T-SQL) language that it needs improvement.

    Actually, amusingly enough, I prefer to keep my scripts in a database. That way, I can apply "tags" to the scripts, like what database they apply to, what version of the database they are dependent on (yes, I keep version numbers of databases, and any DDL command has to apply an update to a CurrentVersions table), what project they are part of, and so on.

    It's not a full-on source control system, but it allows a lot more lookup flexibility than a hierarchy organization (folders and files).

    I got the idea from the original plans for WinFS, and from the way that Vista's photo album allows multiple tags on a picture/video file.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Damus (5/26/2009)


    I agree its a management Issue.

    some other things i would like to see:

    - real foreach loops through table rows.

    - object oriented friendly organization of stored procs and triggers coz they are forgotten once you compile them. I can look them up at the moment on the management studio UI or through some SQL function that I will have to memorize. 🙂

    - enumerations

    those are just what is on my mind right now. will continue tomorrow 🙂

    Thanks again guys

    I guess I'd have to know what "real foreach loops" would mean, as opposed to cursors. Can't agree or disagree with something where I'm not clear on what you mean.

    On organizing procs and such, that would be nice. Would be good to be able to see all procs/triggers/UDFs, etc., that are related to a table, all in one place. Not sure how I'd want that implemented, but the current tree views in SSMS could certainly be improved. Naming conventions and schemas only go so far. (I consider it a great irony of SQL Server that we're managing a relational database through an interface that relies on a hierarchical database of tree-views.)

    I don't know what exactly you mean by enumerations in this case. Care to expand on that?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Damus (5/26/2009)


    Lynn Pettis (5/26/2009)


    Damus (5/25/2009)


    I am just a programmer. Been in the business for over 10 years now, I have changed the way I code so many times, but when it comes to SQL code, its still the same, horribly the same 🙂

    I Might create/use stuff to make things simpler, wrappers, helpers, flashy SQL text editors etc... But, it still is the same old SQL I learned in University

    I say time for change, even if it is gradual

    SQL is changing slowly, but what is wrong with the language? It does what is supposed to do which is access data.

    /sigh. Seems I hit a taboo subject by saying that it is time to change. NOTHING is wrong with it.

    Nothing is wrong with Pascal, or Cobol, or punchcards either. They all do what they are/were supposed to do.

    When did you go through the "University"? SQL Server has changed quite a bit in the last 15 years, especially lately.

    The other thing is, a tool is only as good as its user. If you think that SQL Server has been "horribly" the same for the last 10 years, perhaps it's not the product that's stagnent. 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Damus (5/26/2009)


    Lynn Pettis (5/26/2009)


    Damus (5/25/2009)


    I am just a programmer. Been in the business for over 10 years now, I have changed the way I code so many times, but when it comes to SQL code, its still the same, horribly the same 🙂

    I Might create/use stuff to make things simpler, wrappers, helpers, flashy SQL text editors etc... But, it still is the same old SQL I learned in University

    I say time for change, even if it is gradual

    SQL is changing slowly, but what is wrong with the language? It does what is supposed to do which is access data.

    /sigh. Seems I hit a taboo subject by saying that it is time to change. NOTHING is wrong with it.

    Nothing is wrong with Pascal, or Cobol, or punchcards either. They all do what they are/were supposed to do.

    I think that's the point everyone's trying to make. COBOL is no longer (much) used because it's no longer required. Pascal is still being used in Delphi, which is hasn't died yet. Punchcards don't work well any more 🙂 SQL, however, does exactly what its meant to do, therefore it doesn't need to change!

    Random Technical Stuff[/url]

  • GSquared (5/26/2009)


    Damus (5/26/2009)


    I agree its a management Issue.

    some other things i would like to see:

    - real foreach loops through table rows.

    - object oriented friendly organization of stored procs and triggers coz they are forgotten once you compile them. I can look them up at the moment on the management studio UI or through some SQL function that I will have to memorize. 🙂

    - enumerations

    those are just what is on my mind right now. will continue tomorrow 🙂

    Thanks again guys

    I guess I'd have to know what "real foreach loops" would mean, as opposed to cursors. Can't agree or disagree with something where I'm not clear on what you mean.

    On organizing procs and such, that would be nice. Would be good to be able to see all procs/triggers/UDFs, etc., that are related to a table, all in one place. Not sure how I'd want that implemented, but the current tree views in SSMS could certainly be improved. Naming conventions and schemas only go so far. (I consider it a great irony of SQL Server that we're managing a relational database through an interface that relies on a hierarchical database of tree-views.)

    I don't know what exactly you mean by enumerations in this case. Care to expand on that?

    Sorry for the late reply, I stay in europe 🙂

    1 - foreach loops: Hope I can explain that right 🙂

    I for one, would like to limit all calls to the database to (select record/s, update record/s, delete record/s) which are atomic, easy to maintain and read and SQL server is very efficient at.

    However, in some projects, the architecture is as such that business logic is taken to the SQL server.

    Not saying that either is wrong or right. However, if we choose the second option, then we will have to start writing complex stored procedures using temp tables and cursors and all that. Its times like this when I wish SQL could provide some sort of more friendly syntax to programming (including the foreach , for loop, c syntax enumerations etc...)

  • I thought that SQL Server had the ability to integrate with the .NET CLR, which would allow this to be done... I'm not that familiar with this aspect of the product though. Someone else might want to chime in?

    Random Technical Stuff[/url]

  • Damus (5/27/2009)


    GSquared (5/26/2009)


    Damus (5/26/2009)


    I agree its a management Issue.

    some other things i would like to see:

    - real foreach loops through table rows.

    - object oriented friendly organization of stored procs and triggers coz they are forgotten once you compile them. I can look them up at the moment on the management studio UI or through some SQL function that I will have to memorize. 🙂

    - enumerations

    those are just what is on my mind right now. will continue tomorrow 🙂

    Thanks again guys

    I guess I'd have to know what "real foreach loops" would mean, as opposed to cursors. Can't agree or disagree with something where I'm not clear on what you mean.

    On organizing procs and such, that would be nice. Would be good to be able to see all procs/triggers/UDFs, etc., that are related to a table, all in one place. Not sure how I'd want that implemented, but the current tree views in SSMS could certainly be improved. Naming conventions and schemas only go so far. (I consider it a great irony of SQL Server that we're managing a relational database through an interface that relies on a hierarchical database of tree-views.)

    I don't know what exactly you mean by enumerations in this case. Care to expand on that?

    Sorry for the late reply, I stay in europe 🙂

    1 - foreach loops: Hope I can explain that right 🙂

    I for one, would like to limit all calls to the database to (select record/s, update record/s, delete record/s) which are atomic, easy to maintain and read and SQL server is very efficient at.

    However, in some projects, the architecture is as such that business logic is taken to the SQL server.

    Not saying that either is wrong or right. However, if we choose the second option, then we will have to start writing complex stored procedures using temp tables and cursors and all that. Its times like this when I wish SQL could provide some sort of more friendly syntax to programming (including the foreach , for loop, c syntax enumerations etc...)

    If you are writing stored procedures that are using complex logic with cursors and/or while loops you aren't using the power of SQL and set based processing.

    It would be interesting to see an example of where you are doing this as I am sure there are many people on SSC that would look at how one of your procedures could be rewriting not use a cursor/while loop.

  • Lynn Pettis (5/27/2009)


    Damus (5/27/2009)


    GSquared (5/26/2009)


    Damus (5/26/2009)


    I agree its a management Issue.

    some other things i would like to see:

    - real foreach loops through table rows.

    - object oriented friendly organization of stored procs and triggers coz they are forgotten once you compile them. I can look them up at the moment on the management studio UI or through some SQL function that I will have to memorize. 🙂

    - enumerations

    those are just what is on my mind right now. will continue tomorrow 🙂

    Thanks again guys

    I guess I'd have to know what "real foreach loops" would mean, as opposed to cursors. Can't agree or disagree with something where I'm not clear on what you mean.

    On organizing procs and such, that would be nice. Would be good to be able to see all procs/triggers/UDFs, etc., that are related to a table, all in one place. Not sure how I'd want that implemented, but the current tree views in SSMS could certainly be improved. Naming conventions and schemas only go so far. (I consider it a great irony of SQL Server that we're managing a relational database through an interface that relies on a hierarchical database of tree-views.)

    I don't know what exactly you mean by enumerations in this case. Care to expand on that?

    Sorry for the late reply, I stay in europe 🙂

    1 - foreach loops: Hope I can explain that right 🙂

    I for one, would like to limit all calls to the database to (select record/s, update record/s, delete record/s) which are atomic, easy to maintain and read and SQL server is very efficient at.

    However, in some projects, the architecture is as such that business logic is taken to the SQL server.

    Not saying that either is wrong or right. However, if we choose the second option, then we will have to start writing complex stored procedures using temp tables and cursors and all that. Its times like this when I wish SQL could provide some sort of more friendly syntax to programming (including the foreach , for loop, c syntax enumerations etc...)

    If you are writing stored procedures that are using complex logic with cursors and/or while loops you aren't using the power of SQL and set based processing.

    It would be interesting to see an example of where you are doing this as I am sure there are many people on SSC that would look at how one of your procedures could be rewriting not use a cursor/while loop.

    Sending it to you with an explanation.

  • Damus (5/27/2009)


    Sending it to you with an explanation.

    Why don't you just attach it to this thread so the rest of us can take a peek, as well?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • If you are writing stored procedures that are using complex logic with cursors and/or while loops you aren't using the power of SQL and set based processing.

    It would be interesting to see an example of where you are doing this as I am sure there are many people on SSC that would look at how one of your procedures could be rewriting not use a cursor/while loop.

    One thing that I've never been able to accomplish is to get a recursive CTE that lists all elements in a directed acyclic graph.

    e.g. you have a table x with a node column and a parent column, you can have multiple rows for each node as each node can have multiple parents.

    create table x (node int, parent int);

    insert into x values (1, NULL)

    insert into x values (2, 1)

    insert into x values (3, 1)

    insert into x values (4, NULL)

    insert into x values (5, NULL)

    insert into x values (2, 4)

    insert into x values (2, 5)

    insert into x values (6, 2)

    insert into x values (7, 2)

    Sorry, it's late and I'm tired so I might have made a mistake somewhere in the syntax/structure.

    Random Technical Stuff[/url]

  • Jeff Moden (5/27/2009)


    Damus (5/27/2009)


    Sending it to you with an explanation.

    Why don't you just attach it to this thread so the rest of us can take a peek, as well?

    The "powers that be" who created are proly on SSC. lol trust me, they will know it at first glance, and I will be in trouble.

  • Damus (5/27/2009)


    Jeff Moden (5/27/2009)


    Damus (5/27/2009)


    Sending it to you with an explanation.

    Why don't you just attach it to this thread so the rest of us can take a peek, as well?

    The "powers that be" who created are proly on SSC. lol trust me, they will know it at first glance, and I will be in trouble.

    Understood. But we can't help what we can't see. 😉 Good luck.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (5/27/2009)


    Damus (5/27/2009)


    Jeff Moden (5/27/2009)


    Damus (5/27/2009)


    Sending it to you with an explanation.

    Why don't you just attach it to this thread so the rest of us can take a peek, as well?

    The "powers that be" who created are proly on SSC. lol trust me, they will know it at first glance, and I will be in trouble.

    Understood. But we can't help what we can't see. 😉 Good luck.

    Damus, May I send to code you provided so far to Jeff?

  • Lynn Pettis (5/27/2009)


    Jeff Moden (5/27/2009)


    Damus (5/27/2009)


    Jeff Moden (5/27/2009)


    Damus (5/27/2009)


    Sending it to you with an explanation.

    Why don't you just attach it to this thread so the rest of us can take a peek, as well?

    The "powers that be" who created are proly on SSC. lol trust me, they will know it at first glance, and I will be in trouble.

    Understood. But we can't help what we can't see. 😉 Good luck.

    Damus, May I send to code you provided so far to Jeff?

    For sure, no problem

Viewing 14 posts - 31 through 43 (of 43 total)

You must be logged in to reply to this topic. Login to reply