T-Sql rant

  • Have any of you seen the challace and viewed another way it looks like a face?

    Or a cube drawn on paper, and how the perspective can change.

    I liken doing updates with a loop, vs updates with just a statement to these perspective types, and for me it takes time to switch between the two perspectives.

    This is why I think the language of use could be changed to better sql .

    And I know all of you are rolling your eyes ๐Ÿ™‚ well pooie.

  • foxjazz (3/26/2009)


    Bob, just because I know how to do updates (in mass) or inserts in mass to tables. Doesn't mean I favor the language of use. Don't get me wrong, I have learned a few things here in the update department, and will continue to use the stuff I learn. That doesn't mean I like some of those things.

    For instance, what if I have 100k rows to insert in a table that is dependent on another table. I have to make 2 massive inserts to the tables separately, which might take longer than I wish on a live database. And instead would like to do it in chunks. Then i would code it in chunks. Look I am not saying that it's a bad thing. I am only saying I think there should be more options on how the language could be used.

    All you guys have been a great help, please don't think you haven't been.

    You don't necessarily have to to do it in 2 massive updates. It is possible to "batch" inserts, updates, and deletes. It requires have the knowledge of the data and SQL Server to be able to set it up. There have been quite a few posts where people have asked how they could delete several million rows of data from a table without locking the table or causing excessive growth of the transaction log. These can be done, and still without using cursors, but making use of a while loop.

    Following the instructions in the first article i have referenced below in my signature block, provide us with an example of such a "massive" insert that you wish to complete, just limit the test data to 10 ro 20 rows that is representative of the problem.

  • foxjazz (3/26/2009)


    Have any of you seen the challace and viewed another way it looks like a face?

    Or a cube drawn on paper, and how the perspective can change.

    I liken doing updates with a loop, vs updates with just a statement to these perspective types, and for me it takes time to switch between the two perspectives.

    This is why I think the language of use could be changed to better sql .

    And I know all of you are rolling your eyes ๐Ÿ™‚ well pooie.

    Fox, you're not Tat O. by any chance, are you? From Cotechna in '97 and Atlantic in '01?

    โ€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.โ€ - Gail Shaw

    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

  • No, sorry, from Franklin TN originally, but live in (today) snowy Denver.

    Need to go home cause of blizzard conditions.

    Lynn, dude you rock.

  • foxjazz (3/26/2009)


    No, sorry, from Franklin TN originally, but live in (today) snowy Denver.

    Need to go home cause of blizzard conditions.

    Lynn, dude you rock.

    Well the blizzard hasn't hit here yet in the Springs. Thank God I don't commute to Denver any more (15 years of that was more than enough!).

  • Fox:

    For whatever help any of my comments might have been, you are welcome.

    Steve D:

    I'm about to unsubscribe from this thread, but I would like to leave you some thoughts before I go. Unlike my previous post to you, there is no sarcasm in what follows. I am not trying to discourage you.

    You are understandably eager to engage in a technical debate about your product, if I may call it that even though I know it is now free to the public. I will freely confess that I haven't visited your site or examined the technical merits of your product. Therefore, I am not qualified to engage you in a technical debate about it, and for all I know it may be a brilliant step forward in the arcane arts of coding.

    That said, I think you should understand that most of us aren't going to take the time to listen, much less debate you. I'm not dismissing you, I just think this may not be the proper forum for winning hearts and minds to your cause. We all have day jobs, and are busy enough just trying to use the tools we already have. The company I work for would not consider using your product, even though it's free, because of questions about compatibility, support, scalability, education, availability of potential employees who will know how to work with it day one, and a dozen other checklist items that must be satisfied. You cannot realistically expect an organization to commit the enormous people expense in that would entail without realizing truly PHENOMENAL gains in productivity. Five or ten percent won't get it.

    Your zeal, while admirable in many respects, reminds me of some people in IBM who told me (again back in the early 80's) quite sincerely that by 2000 all operating systems would be some flavor of Unix, or the bright young minds in the 90s who told me that everyone would go Linux because it was free. But time has taught me that technical superiority of a product doesn't always translate into survivability in the marketplace. When the IBM PC first came out, MS-DOS originally didn't look like the OS of choice to a lot of people.

    If you want to make your product dream a reality, you really need to engage the people at Microsoft. To be frank, you may not find a receptive audience if your opening line is "None of you understand anything about the relational model." Understand that there are a lot of bright minds in this world, and not all of them will agree with you. Also understand that a lot of organizations are getting the job done quite well without your product. A number of good people who are good at both SQL and other languages have responded to you in this thread, and most all of them didn't seem to see the need.

    Although it may help you keep your morale up, you cannot afford to dismiss or disrespect the people who disagree with you, because you are the one asking them to change. You may not think the business considerations I listed should matter, but they do. As the agent of change, you face a considerable "burden of proof" that taking a chance with your product is worth the expense.

    Although I'm not in your camp, I wish you luck in the future. The idealist in me likes to root for the underdogs and Don Quixote's of this world.

    Peace, out.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Bob Hovious (3/26/2009)


    F

    Steve D:

    I'm about to unsubscribe from this thread, but I would like to leave you some thoughts before I go. Unlike my previous post to you, there is no sarcasm in what follows. I am not trying to discourage you.

    You are understandably eager to engage in a technical debate about your product, if I may call it that even though I know it is now free to the public. I will freely confess that I haven't visited your site or examined the technical merits of your product. Therefore, I am not qualified to engage you in a technical debate about it, and for all I know it may be a brilliant step forward in the arcane arts of coding.

    That said, I think you should understand that most of us aren't going to take the time to listen, much less debate you. I'm not dismissing you, I just think this may not be the proper forum for winning hearts and minds to your cause. We all have day jobs, and are busy enough just trying to use the tools we already have. The company I work for would not consider using your product, even though it's free, because of questions about compatibility, support, scalability, education, availability of potential employees who will know how to work with it day one, and a dozen other checklist items that must be satisfied. You cannot realistically expect an organization to commit the enormous people expense in that would entail without realizing truly PHENOMENAL gains in productivity. Five or ten percent won't get it.

    Your zeal, while admirable in many respects, reminds me of some people in IBM who told me (again back in the early 80's) quite sincerely that by 2000 all operating systems would be some flavor of Unix, or the bright young minds in the 90s who told me that everyone would go Linux because it was free. But time has taught me that technical superiority of a product doesn't always translate into survivability in the marketplace. When the IBM PC first came out, MS-DOS originally didn't look like the OS of choice to a lot of people.

    If you want to make your product dream a reality, you really need to engage the people at Microsoft. To be frank, you may not find a receptive audience if your opening line is "None of you understand anything about the relational model." Understand that there are a lot of bright minds in this world, and not all of them will agree with you. Also understand that a lot of organizations are getting the job done quite well without your product. A number of good people who are good at both SQL and other languages have responded to you in this thread, and most all of them didn't seem to see the need.

    Although it may help you keep your morale up, you cannot afford to dismiss or disrespect the people who disagree with you, because you are the one asking them to change. You may not think the business considerations I listed should matter, but they do. As the agent of change, you face a considerable "burden of proof" that taking a chance with your product is worth the expense.

    Although I'm not in your camp, I wish you luck in the future. The idealist in me likes to root for the underdogs and Don Quixote's of this world.

    Peace, out.

    Well I've been called a lot things with the noun 'dog' in it but never underdog. Many have been adverbs and adjectives. But I appreciate the spirit behind the thought.

    But really I'm not driving for submission impossible. I'm not attempting to tell sql experts to drop what their doing and substitute something else for their bread and butter. What I am suggesting is that sql experts, when they do have some free time, play with dataphor. And specifically to "play" with the relational algebra. Forget the 'development' idea and just concentrate on constructing queries that require an algebra instead of the type of construction that sql uses. Yeah there's a learning curve but, as I've said elsewhere, the ability to write complicated sql queries will lend itself to this new type of query construction. And I'm not saying you will enjoy it, I'm saying you will really enjoy it: -). After all what's on the t-sql wish list of many experts is already here -:). You don't have to sign on for the full meal. A little a la carte can go a long way. Take a bite. If you like it take another.

    As for talking to vendors are you familiar with the concept of 'turf' -:)

    best,

    steve

    www.beyondsql.blogspot.com

  • Guys & gals, I think it's time to stop feeding the troll.

    Clearly he is arguing himself into a corner because he can't admit that his original premise was based on insufficient knowledge of T-SQL and set based programming.

    I program in C# as much as I do SQL and instead of pissing and moaning about having to do things two different ways, I embrace the challenge of changing my mode of thinking when necessary.

    Why

    "insert into (a,b)

    select c, d from table" is so difficult for the OP to grasp, I don't know. But it seems he is more interested in riling folks than learning, so why waste time on it?

    --
    Anye Mercy
    "Service Unavailable is not an Error" -- John, ENOM support
    "You keep using that word. I do not think it means what you think it means." -- Inigo Montoya in "Princess Bride"
    "Civilization exists by geologic consent, subject to change without notice." -- Will Durant

  • Anye Mercy (4/3/2009)


    Guys & gals, I think it's time to stop feeding the troll.

    Shhhhhh.... he's asleep, let's keep it that way:satisfied:

    โ€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.โ€ - Gail Shaw

    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

  • If you like cursors so much, why not use ORACLE instead, it works well with cursors. MS SQL Server was developed to work well using sets, and it works quite well. It doesn't need to be optimized for working with cursors.

    Why is this such a common belief? It is simply not true. Oracle, like any SQL based DBMS works better with sets than cursors. There is nothing magical about Oracle cursors, they are orders of magnitude slower than if you can do the same thing with sets, just like SQL Server. I know, I've worked extensively with both.

    The only difference (in this regard) is that Microsoft comes right out and says "don't use cursors if you don't absolutely have to" while Oracle (the company) says almost nothing about it. In fact, as soon as you start using any PL/SQL functions, you are using a cursor, whether you know it or not. I've rewritten many an Oracle query that was performing poorly because the original developer just assumed that Oracle cursors work great, or didn't even realize he was using a cursor.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/

  • foxjazz (3/13/2009)


    ok example sort of (my computer is sick so I can't give you something already done)

    select name from mynametable where changedate > @yesterday

    fetch from @sel into @name

    while (@@fetch_status = 0)

    begin

    insert into nameother (name,changeddate) values (@name,getdate())

    end

    Do this without a cursor!

    Are you kidding?!?! That's so easy!

    insert into nameother (name,changeddate)

    select name, getdate() from mynametable where changedate > @yesterday

  • Spot on, DC.

    --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)
    Intro to Tally Tables and Functions

  • Dude, that is why MS created DAO or ADO. It allows you to create databases using COM objects.

    x = new DAO.database

    y=dao.field

    z-dao.table

    etc etc

    SQL is a language that is used to query data from databases and return a result set. The resultset can be accessed in DAO using recordset objects. So where is your problem???

  • Hi guys, I realize I'm late to join the fray, but ye gads what a lively topic! I just saw the link posted in my morning newsletter from SQLServerCentral.com and I had to take a peek.

    You know, although I certainly agree with the general message from all the SQL champions who jump to defend its virtues that "foxjazz"' complaints are born out of a poor understanding of the tool, I can't help but appreciate the value of this kind of debate. Even though his desire to see development and RDBMS languages melded is akin to wanting a Swiss Army knife - which can do all things but is optimized for none - we shouldn't really demonize him for wanting it. We know that demanding that TSQL have efficient accommodation for row-based processing, and being frustrated with the language because it doesn't, is a bit like being mad at your hammer because it doesn't work well with screws. But I can walk a few feet in foxjazz' shoes and at least understand why he posed the initial question: In order to do what he wants to do (right, wrong or indifferent) he feels that he has to jump out of his comfort zone and learn a new skill. He's frustrated that he can't do the whole thing with C# and on principal, I can't blame him for that. It's easy to criticize when you have mastery of several languages and understand how each is optimized for its job, and more importantly the contrast between the genre of dev languages and TSQL, but foxjazz doesn't have that.

    I definitely do think that foxjazz' approach could have been better, but just look at this thread! He has inadvertently roused the both the dander and creativity of some VERY smart people, and I think that if we all step back and take a stance of objectivity on this we can see that it was a good discussion and that some knowledge transfer probably did occur.

    That which conjurs angst and consternation sometimes has the happy byproduct of new understanding.

    -Bob St. Aubyn

  • foursaints, I appreciate the note. I have never had any problems with inserting data, or query, but my understanding of updates (multiple rows at a time) with different data, is where I have had troubles. And so have just resorted to t-sql cursors because it resembles the language I am use to.

    It's funny cause I have written code that does mass updates, and it seems something ripped that knowledge from my brain 2 years ago.

    What I find most cool is some of the new stuff I have been doing: Check this out with edmx:

    Below is code i wrote last night using Entity data and damn it works great. I am very happy that c# now has this capability. Not to mention the speed. I think if there was a way to send my object to a stored procedure instead of having to maintain this in code, it would be a better design. But who am I to say anything about the limitations of t-sql?

    FleetVinEntities fves = new FleetVinEntities();

    QueueBase qb;

    QueueVin qv;

    QueueCats qc1;

    qb = new QueueBase();

    qb.email = vindata.email;

    qb.FleetID = vindata.FleetID;

    qb.username = vindata.username;

    qb.division = vindata.Division;

    fves.AddToQueueBase(qb);

    fves.SaveChanges();

    foreach(FleetVinQueue.VinUnit vin in vindata.Vins)

    {

    qv = new QueueVin();

    qv.QueueNum = qb.QueueNum;

    qv.vin = vin.vin;

    qv.Unit = vin.unit;

    fves.AddToQueueVin(qv);

    }

    foreach (int cat in vindata.CategoryIDs)

    {

    qc1 = new QueueCats();

    qc1.QueueNum = qb.QueueNum;

    qc1.CategoryID = cat;

    fves.AddToQueueCats(qc1);

    }

    fves.SaveChanges();

Viewing 15 posts - 391 through 405 (of 465 total)

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