Re: Update & Delete

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jason Williams (jasonwilliams_at_msn.com)
Date: 03/11/04


Date: Wed, 10 Mar 2004 19:42:17 -0500

Thanks to both of you,

I clearly have a long way to go, and the help is appreciated. Any books
and/or courses you recommend?

Jason

"Joe Celko" <joe.celko@northface.edu> wrote in message
news:e6GWR0vBEHA.1452@TK2MSFTNGP09.phx.gbl...
> >> update a column in table "A" from a column in table "B", and then
> delete the record [sic] in table "B". <<
>
> Since you area newbie, you might want to learn Standard SQL syntax; the
> proprietary one you used ports to a few other products and to earlier
> versions of Sybase/SQL Server, but with different semantics! The worst
> possible situation for maintaining code.
>
> The short answer is do it in a procedure, somethign liie this:
>
> BEGIN
> UPDATE TableA
> SET colA
> = (SELECT colB
> FROM TableB
> WHERE TableA.relatedA = TableB.relatedB);
> DELETE FROM TableB
> WHERE colB
> IN (SELECT colA FROM TableA);
> END;
>
> --CELKO--
> ===========================
> Please post DDL, so that people do not have to guess what the keys,
> constraints, Declarative Referential Integrity, datatypes, etc. in your
> schema are.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: unusual stiff ankle problem
    ... >Jason wrote: ... >> doctor but did take various courses in college such as biology and spend ... doctors learn much of what they know from medical books written by ... >yet shouldn't be dispensing medical advice. ...
    (sci.med)
  • Re: Is there a generic type that is similar to the VB6 Collection object?
    ... Jason, ... I would recommend System.Collections.ObjectModel.KeyedCollection ... NOTE: There are VS 2005 specific forums available at: ... Jay ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Training Centers.
    ... Mate, look through the courses and choose the 1 or 2 that you would gain the ... recommend going to a MS Training Centre to do. ...
    (microsoft.public.cert.exam.mcse)
  • Re: Pop Goes the Weasel
    ... Rich Travsky wrote: ... as Jason says it's never even been discussed once on any of his ... courses ever, and appears to think that this is the norm, and as ... paleoanthropological circles it is just not de rigeur. ...
    (sci.anthropology.paleo)
  • Re: how many math courses
    ... > contents overlap each other's and whether their contents overlap the ... > technical courses, and you are pushing the limit when you try it, even ... Do you recommend I try and fit these courses in my senior ... unless it is recommended that I take them before grad school. ...
    (sci.math)