Old Dog, New Tricks

  • Comments posted to this topic are about the item Old Dog, New Tricks

  • You can teach an old dog new tricks! Mythbusters proved that one 🙂

    Coming from an Oracle background, I always use semi-colons, but strangely SSRS (using BIDS 2008) removes them automatically when you use them (in the rare event that I don't used a stored proc)

    If you use Openquery from SQL Server to Oracle with the OraOLEDB.Oracle provider it returns an error "invalid character" if you use a semicolon in the passed-through query.

    It might be ANSI but it's not consistently applied.

  • Fun topic.

    About alias, I do not agree. I think "as" is the way to go. It's standard and everyone understands it and you don't risk confusion, it also does not take any more time to write "as" than "=", if anything "as" goes faster.

    About aging, it's been proven recently that people over 45 solves equations a bit more slowly than younger ones.

    With that said, I feel some people now must raise their voices to redeem themselves and point to that experience and knowledge holds a high value as well and I do of course agree.

    Also, it's common that engineers has an iq around 125, thus giving an advantage still over the general population, not that it matters except you have the ability to claim a more interesting job and complete it.

    Then about learning new things, I do not think that has to do with age. I firmly believe some people are more interested and might also be better at grasping new concepts than others. It might just stand out more when someone who is old is not interested to learn. Then there is one more thing I'd like to point out, science has proven that our brain actually hurts a little when we learn new things and this might be a cause for pointing us towards old habits. Then of course some people are just plane lazy.

  • I am a developer and am here to improve my knowledge of SQL Server especially my T-SQL

    As a bit of a pedant when it comes to coding, I read the article and initially thought that I had learnt nothing. I currently use AS due to its explicit declaration of my intention (as covered by the article), however, as I know that even halfway decent articles always have a point, whether you agree with it or not, and the author said that he favoured = over AS I reread it.

    It was when I looked at the side-by-side stored procedures example that it became clear. Literally!!!

    I shall be using the = syntax moving forward. My reasoning? The intention is clearer to the reader. Not only of the alias but of the structure being returned. Removing ambiguity from code is the key to delivering a maintainable system.

    As for standards? Well, SQL standards should be looking at issues and opportunities such as this but lets not hold our collective breath as it is a necessarily a slow process. Also I have yet to see a RDBMS migration project where they don't treat existing SQL statements as specifications for a rewrite. Anyone compared the various XML syntax?

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • Actually SQL Server is being changed iteratively, it is not evolving. It is being directed to a goal by intelligence.

  • vmit02 (2/2/2012)


    Actually SQL Server is being changed iteratively, it is not evolving. It is being directed to a goal by intelligence.

    That also falls under the category of evolving.

  • Sheesh...and I thought I was a pedant. Really guys, is this not straying off topic? 😉

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • I've used the SELECT 1 x; format for years. (Oracle background).

    I've never found it confusing - I don't now discard that format just because somebody else finds it confusing.

    Matter of taste really.

  • I've used the = syntax for many years because it's so much easier for me to read. When there's a long case statement and I'm looking at someone else's T-SQL, I feel that it wastes my time if I have to sift through the lines to find out what the column name is.

    BTW, I switched to using the JOIN ... ON syntax a few years ago, as well, for readability reasons.

  • IceDread (2/2/2012)


    About aging, it's been proven recently that people over 45 solves equations a bit more slowly than younger ones.

    Really? I'd like to see that documentation. I'm over 45 and believe I solve problems and equations much faster than my younger peers. That's because I have more experience doing it. Maybe once they are my age, they can do it faster too.

  • You know what's funny is some of the code I wrote over 10 years ago have the *= syntax instead of the joins. I now look at that and wonder what was I thinking. It's more confusing even for me when I review my own code. As I come upon some of that older syntax, I change it to use the join syntax instead just for readability.

    I definitely prefer the As instead of x= SomeExpressionOrColumn because I think it's more important to know the source of the data than it's column name.

  • As a set in my ways C programmer, I find it irritating enough that SQL overloads the = operator to mean both assignment and a test of equality (I mean, seriously, was the designer of SQL an old BASIC programmer? :-P), without adding yet another different meaning to it!

  • paul.knibbs (2/2/2012)


    As a set in my ways C programmer, I find it irritating enough that SQL overloads the = operator to mean both assignment and a test of equality (I mean, seriously, was the designer of SQL an old BASIC programmer? :-P), without adding yet another different meaning to it!

    I totally understand that. Following reading the article, if I was part of designing the SQL as a new language then with the old 20:20 hindsight I would have suggested that the AS keyword was used but that the alias came first i.e. SELECT x AS 1 instead of SELECT 1 AS x. Obviously this change could never happen and nor should it. I would prefer another keyword\operator than = but cannot think of one.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • I use AS on column aliases but nothing on table aliases, might need to sort that out!

    Can't see me switching to = on columns, although I can see the point on readability.

    Really need to get into the habit of using semicolons too.

    But then think I'm still a young dog (just!) so maybe there's hope!

  • Gary Varga (2/2/2012)

    I totally understand that. Following reading the article, if I was part of designing the SQL as a new language then with the old 20:20 hindsight I would have suggested that the AS keyword was used but that the alias came first i.e. SELECT x AS 1 instead of SELECT 1 AS x. Obviously this change could never happen and nor should it. I would prefer another keyword\operator than = but cannot think of one.

    That just makes me think "computed column" 🙂

    How about AKA, as in: SELECT x AKA 1 ?

Viewing 15 posts - 1 through 15 (of 92 total)

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