Syntax Error Updating SQL Server Table - Page 2


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27

Thread: Syntax Error Updating SQL Server Table

  1. #16
    MarkN Guest

    Re: Syntax Error Updating SQL Server Table


    >And every other commercial software vendor, I suppose. What would be the


    >value of products from multiple vendors, if they all followed the standard,


    >and didn't extend it? Would be a bit like ice cream vendors just selling


    >vanilla or chocolate, I think.


    Extending (following and going further) is more than fine. Breaking it (going
    your own way will making it seem like you are following the standard) isn't.
    "Let me count the ways ..."

  2. #17
    kevin knudson Guest

    Re: Syntax Error Updating SQL Server Table


    Actually I read BOL quite a bit, I feel it is another one of SQL Servers better
    points. One fully indexed reference for almost anything you need to know.
    Although in this case I went from memory. Old and frail as it is.

    Prior to SQL Server / UDB I was a heiracrchetical(?) DL/I - IMS DBA, I've
    never used DB2 on the mainframe. But I've done a lot of SQL coding as a
    developer and/or DBA in the last 10 years.

    Updating a bunch of fields, well that might make the JOIN a better alternative.

    Again from memory





    "Markn" <m@N.com> wrote:
    >
    >>I wasn't trying to be snotty,

    >
    >Ok. It is oft times difficult to communicate via the 'written' word. Many
    >a time I have started an email, killed it and made a phone call.
    >
    >
    >
    >>although I understand it may come across that
    >>way. However, I find it of slightly doubtful value to reply that something

    >
    >>can't be done, without being absolutly sure it can't.

    >
    >First - He said he thought. Not that he knew. No absolute there.
    >
    >Second. I agree that unless one is absolutely sure ... . That is why I
    >question people when they say something like "We will never use anything
    >but Windows."
    >
    >Third. It is difficult(not saying impossible - thinking it yes) to prove
    >the lack of the existence of anything. Not without some presuppositions.
    >
    >
    >>Hence the reference
    >>to Books Online, as the syntax for UPDATE is readily available.

    >
    >We've both probably written alot of SQL. Kevin probably a lot before SQL
    >Server was a twinkle in Bill's eye. Why would he check something so simple
    >as an Update statement in Online Books? (Ok, now we have a reason)
    >
    >>
    >>I agree though, that it's slightly, errr..., opaque. It's obvious you can

    >
    >>use a FROM clause somehow. How that is done isn't quite as clear.

    >
    >This one is not so bad and actually maybe better. But when one joins more
    >than 2 tables and has more where statments and more fields then it becomes
    >a jumble. Plus, it is usually more to type when one is handcoding SQL (Typing
    >- one of my Achilles heels).
    >



  3. #18
    MarkN Guest

    Re: Syntax Error Updating SQL Server Table


    Rune Bivrin <rune@bivrin.com> wrote:
    >"kevin knudson" <klk@knudsons.com> wrote in news:3d4fed4d$1@10.1.10.29:
    >
    >>
    >> No offense takin, I have a pretty thick skin. And have learned "there
    >> are many ways to skin a cat".
    >>
    >> Thanks for the vote of confidence though, Mark.
    >>
    >> MSAccess SQL is not quite SQL, it is it's own variant, as are all SQLs
    >> really.
    >> Although the later versions allow much more compatible SQL than
    >> priors. Look at the actual JOIN syntax in Access is := ...
    >>
    >> Personally I still prefer the sub select I wrote to a join, just seems
    >> clearer.
    >> I'll have to push them through Query Analyzer later and see which has
    >> the
    >> better performance.
    >>
    >>
    >> KlK, MCSE
    >>

    >I agree that the sub select is easier to read. There arises a slight
    >complication though, when you want to update more than one field. It's
    >gonna be an awful lot of sub selects, don't you think? Or am I being dense


    >now? (Quite possible, I assure you!)
    >
    >Rune Bivrin


    It might be time for [re]design and/or refactor.

  4. #19
    Rune Bivrin Guest

    Re: Syntax Error Updating SQL Server Table

    "Markn" <m@N.com> wrote in news:3d4fef3a$1@10.1.10.29:

    >
    > We've both probably written alot of SQL. Kevin probably a lot before
    > SQL Server was a twinkle in Bill's eye. Why would he check something
    > so simple as an Update statement in Online Books? (Ok, now we have a
    > reason)


    So have I, starting with IBM-s Database Manager anno 1990. And after
    posting some bone-headed suggestions, I'm in the habit of running the code
    and checking the manual before I post a solution. I just hate looking like
    an idiot, when I don't have to.

    Rune Bivrin

  5. #20
    Rune Bivrin Guest

    Re: Syntax Error Updating SQL Server Table

    "MarkN" <m@n.com> wrote in news:3d500263$1@10.1.10.29:

    >>I agree that the sub select is easier to read. There arises a slight
    >>complication though, when you want to update more than one field. It's
    >>gonna be an awful lot of sub selects, don't you think? Or am I being
    >>dense now? (Quite possible, I assure you!)
    >>
    >>Rune Bivrin

    >
    > It might be time for [re]design and/or refactor.
    >

    It might, and then again maybe not. I often make use of that feature, and
    can't say I've ever felt like I'm doing bad design. It's often been when
    changing database schema, so it's not your average on-line SQL, generally.

    Rune Bivrin

  6. #21
    kevin knudson Guest

    Re: Syntax Error Updating SQL Server Table


    Okay so now I take offense, your saying I looked like an idiot. Oh I did,
    but I cut my pony tail, so now at least I'm a clean cut idiot. :-} Just
    kidding.

    I did run my idea through QA, and it worked. I still conceptually don't
    like using a JOIN in an update. Updating multiple fields, that may be different,
    although I still don't like a JOIN here. Doesn't mean I wouldn't use it,
    just wouldn't like it.

    I also would prefer not to solve someones problem here, just point them in
    the right direction. Unless I am doing the work I like to present ideas,
    not solutions, let the person doing the work come up with the solution.

    Sorry I was management at one time, now I'm back to techie, and a happy man
    for it.

    KlK, MCSE

    Rune Bivrin <rune@bivrin.com> wrote:
    >"Markn" <m@N.com> wrote in news:3d4fef3a$1@10.1.10.29:
    >
    >>
    >> We've both probably written alot of SQL. Kevin probably a lot before
    >> SQL Server was a twinkle in Bill's eye. Why would he check something
    >> so simple as an Update statement in Online Books? (Ok, now we have a
    >> reason)

    >
    >So have I, starting with IBM-s Database Manager anno 1990. And after
    >posting some bone-headed suggestions, I'm in the habit of running the code


    >and checking the manual before I post a solution. I just hate looking like


    >an idiot, when I don't have to.
    >
    >Rune Bivrin



  7. #22
    MarkN Guest

    Re: Syntax Error Updating SQL Server Table


    >It might, and then again maybe not. I often make use of that feature, and


    >can't say I've ever felt like I'm doing bad design.


    Refactoring doesn't mean you did a bad design.

    I've never had to do query like that. (For what that is worth)

    >It's often been when
    >changing database schema, so it's not your average on-line SQL, generally.


    Ok. I can definitely see that. So you do it typically during 'refactoring'.




  8. #23
    MarkN Guest

    Re: Syntax Error Updating SQL Server Table


    >I've never used DB2 on the mainframe.


    I have. So I've got at least one thing one you. I wasn't a DBA though.
    Not that I really am now. An application DBA maybe but not a hard core.


  9. #24
    Rune Bivrin Guest

    Re: Syntax Error Updating SQL Server Table

    "MarkN" <m@n.com> wrote in news:3d51137b$1@10.1.10.29:

    >>It's often been when
    >>changing database schema, so it's not your average on-line SQL,
    >>generally.

    >
    > Ok. I can definitely see that. So you do it typically during
    > 'refactoring'.
    >
    >
    >

    Not necessarily 'typically', but often. I spend much, maybe even most, of
    my development time refactoring, to the degree that I don't even think
    about it. It comes naturally.

    Refactoring in the database is rarer, though. Database modeling seems to be
    more constrained by hard rules than general programming, and changing the
    database schema frequently tends to be a tad impopular with the
    developers...

    I guess one of the reasons I use the UPDATE xx FROM construct is the same
    as for using other tools. You tend to find (and solve) those problems for
    which your tools are appropriate.

    Rune Bivrin

  10. #25
    MarkN Guest

    Re: Syntax Error Updating SQL Server Table



    >>

    >Not necessarily 'typically', but often.

    "You say potato .. ."

    >I spend much, maybe even most, of
    >my development time refactoring,


    As should everyone.


    >to the degree that I don't even think
    >about it. It comes naturally.

    Me too.


    >
    >Refactoring in the database is rarer, though. Database modeling seems to

    be
    >more constrained by hard rules than general programming, and changing the


    >database schema frequently tends to be a tad impopular with the
    >developers...


    Bet I know why.

    Since I we don't have a DBA we get to get be impopular with ourselves. Seriously
    though, following certain techniques - usually ones not popular with DBAs
    - this is of little impact.

    >
    >I guess one of the reasons I use the UPDATE xx FROM construct is the same


    >as for using other tools. You tend to find (and solve) those problems for


    >which your tools are appropriate.


    Which is why the problem needs to be determined first and then find the tool.



  11. #26
    Rune Bivrin Guest

    Re: Syntax Error Updating SQL Server Table

    "MarkN" <m@n.com> wrote in news:3d513df0$1@10.1.10.29:

    >
    > Bet I know why.
    >
    > Since I we don't have a DBA we get to get be impopular with ourselves.
    > Seriously though, following certain techniques - usually ones not
    > popular with DBAs - this is of little impact.
    >

    Back when I was younger, and nobody expected me home, my favourite
    "technique" would be to take the weekend to apply the changes to the DB,
    and work through all (literally!) the source code and change it to reflect
    the new schema. Bummer if any of the developers had things checked out that
    needed modification. These days, I try to spend more time modelling up-
    front...

    Would you care to share some of these certain techniques?

    > Which is why the problem needs to be determined first and then find
    > the tool.
    >

    Who's being snotty now?

    I agree, but there are times when the only way to determine the true nature
    of the problem involves trying to solve it. Not always, but occasionally.

    Rune Bivrin


  12. #27
    MarkN Guest

    Re: Syntax Error Updating SQL Server Table


    Rune Bivrin <rune@bivrin.com> wrote:
    >"MarkN" <m@n.com> wrote in news:3d513df0$1@10.1.10.29:
    >
    >>
    >> Bet I know why.
    >>
    >> Since I we don't have a DBA we get to get be impopular with ourselves.
    >> Seriously though, following certain techniques - usually ones not
    >> popular with DBAs - this is of little impact.
    >>

    >Back when I was younger, and nobody expected me home, my favourite
    >"technique" would be to take the weekend to apply the changes to the DB,


    >and work through all (literally!) the source code and change it to reflect


    >the new schema. Bummer if any of the developers had things checked out that


    >needed modification. These days, I try to spend more time modelling up-
    >front...
    >
    >Would you care to share some of these certain techniques?


    Don't use SPs. Limit triggers. Use mapping tools (ie. Hibernate). Can
    problems be prevented 100%? No. But they can be majorly minimized and with
    OR mapping issues and can be found much quicker.

    >
    >> Which is why the problem needs to be determined first and then find
    >> the tool.
    >>

    >Who's being snotty now?


    Sorry. Should have put a [sigh] or something in there. Doing the 'what'
    then the 'how' very seldom happens.

    >
    >I agree, but there are times when the only way to determine the true nature


    >of the problem involves trying to solve it. Not always, but occasionally.


    True. I guess the solution is to realize the tools are just as expendable
    as the code.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center