Update column

  • Hello...

    I need to add a varchar type of data into a column without erase any registry of the column.

    I need to add it at the end of every registry.

    thanks in advance.

  • What do you mean by registry ?

    I really dont understand your needs.



    Clear Sky SQL
    My Blog[/url]

  • What????

    Have you read the SQL Books Online for the syntax for an UPDATE statement?

    Can you give us an example of what the "registry" is?

    Andrew SQLDBA

  • ok.

    table A (original)

    c1 c2 c3

    a 1 a1

    b 2 b2

    c 3 c3

    d 4 d4

    Output

    table a

    c1 c2 c3

    a 1 a1 don´t use

    b 2 b2 don´t use

    c 3 c3 don´t use

    d 4 d4 don´t use

    I hope ´my problem is clear now. Thanks for your patience.

  • Im guessing here...

    Update yourtable set c3 = c3+' dont use'

    Is that what you mean ?



    Clear Sky SQL
    My Blog[/url]

  • Dave Ballantyne (12/30/2009)


    Im guessing here...

    Update yourtable set c3 = c3+' dont use'

    Is that what you mean ?

    Yes, but i need to do that for every record in the column.

  • igngua (12/30/2009)


    Dave Ballantyne (12/30/2009)


    Im guessing here...

    Update yourtable set c3 = c3+' dont use'

    Is that what you mean ?

    Yes, but i need to do that for every record in the column.

    As there is no where clause on the update statement , the update will be done on every row in your table.



    Clear Sky SQL
    My Blog[/url]

  • Here we have someone who has no clue as to how to use one the basic 4 elements of the SQL language and they're going to update a whole table. I can smell the burning hair now. 😛

    I'd make the strong recommendation that a backup be taken and a restore tested before doing this update, but those two words are probably just as foreign. :hehe:

    --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

  • LMAO

    Exactly Right. At least make a copy of the table first.

    Andrew SQLDBA

  • Jeff Moden (12/30/2009)


    Here we have someone who has no clue as to how to use one the basic 4 elements of the SQL language and they're going to update a whole table. I can smell the burning hair now. 😛

    I'd make the strong recommendation that a backup be taken and a restore tested before doing this update, but those two words are probably just as foreign. :hehe:

    On a crueller day i could of said "Ahhh, you need to drop database <yourdatabase>"

    Im hoping this is day one of picking up a SQL book , and not a mission critical operation. Still , we've seen stranger on here 😉



    Clear Sky SQL
    My Blog[/url]

  • igngua (12/30/2009)


    Hello...

    I need to add a varchar type of data into a column without erase any registry of the column.

    I need to add it at the end of every registry.

    thanks in advance.

    Please don't take this the wrong way... I'm looking out for your best interest. If you don't know how to do this, you should not be attempting this on production data. You need to "practice" first.

    My recommendation is that you get at least a basic understanding of what SQL and databases are all about. They have a nice basic SQL Tutorial on w3schools.com where you can actually try some things out.

    --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

  • Dave Ballantyne (12/30/2009)


    Jeff Moden (12/30/2009)


    Here we have someone who has no clue as to how to use one the basic 4 elements of the SQL language and they're going to update a whole table. I can smell the burning hair now. 😛

    I'd make the strong recommendation that a backup be taken and a restore tested before doing this update, but those two words are probably just as foreign. :hehe:

    On a crueller day i could of said "Ahhh, you need to drop database <yourdatabase>"

    Im hoping this is day one of picking up a SQL book , and not a mission critical operation. Still , we've seen stranger on here 😉

    Heh... just to be sure, I wasn't directing that to anyone in particular. This type of stuff just scares the hell out of me for someone's data out there. :hehe:

    --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

  • it workerd just fine.

    thanks to everyone.

Viewing 13 posts - 1 through 12 (of 12 total)

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