SQL Server Management Studio. Update T1 set T1.Field1 = y where T1.Field1= x Would this work?How do you specify a different port number in SQL Management Studio?Solutions for INSERT OR UPDATE on SQL ServerSQL Formatter for SQL Management Studiohow can I Update top 100 records in sql serverMySQL - UPDATE query based on SELECT Querysql server invalid object name - but tables are listed in SSMS tables listUpdate a table using JOIN in SQL Server?SQL Server: How to Join to first rowHow do I UPDATE from a SELECT in SQL Server?Where is SQL Server Management Studio 2012?

Are Warlocks Arcane or Divine?

A known event to a history junkie

Proof of Lemma: Every integer can be written as a product of primes

node command while defining a coordinate in TikZ

Perfect riffle shuffles

Can I rely on these GitHub repository files?

Can I create an upright 7-foot × 5-foot wall with the Minor Illusion spell?

Greatest common substring

Can a malicious addon access internet history and such in chrome/firefox?

Is there a good way to store credentials outside of a password manager?

Golf game boilerplate

What do you call the infoboxes with text and sometimes images on the side of a page we find in textbooks?

Partial sums of primes

Is infinity mathematically observable?

How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?

Word describing multiple paths to the same abstract outcome

Superhero words!

Latex for-and in equation

Simulating a probability of 1 of 2^N with less than N random bits

A workplace installs custom certificates on personal devices, can this be used to decrypt HTTPS traffic?

Bob has never been a M before

Was the picture area of a CRT a parallelogram (instead of a true rectangle)?

Organic chemistry Iodoform Reaction

Is there enough fresh water in the world to eradicate the drinking water crisis?



SQL Server Management Studio. Update T1 set T1.Field1 = y where T1.Field1= x Would this work?


How do you specify a different port number in SQL Management Studio?Solutions for INSERT OR UPDATE on SQL ServerSQL Formatter for SQL Management Studiohow can I Update top 100 records in sql serverMySQL - UPDATE query based on SELECT Querysql server invalid object name - but tables are listed in SSMS tables listUpdate a table using JOIN in SQL Server?SQL Server: How to Join to first rowHow do I UPDATE from a SELECT in SQL Server?Where is SQL Server Management Studio 2012?













0















Update T1 set T1.Field1 = y where T1.Field1 = x


Would this syntax work?



I want to update the field to equal 40 where that field is currently equal to 50. This would update several rows when run the first time.



I would hope that it would update zero rows when attempting to run it the second time.










share|improve this question

















  • 2





    Yes, it should work

    – dassoun
    Mar 7 at 9:59






  • 1





    ...and it'll update 0 rows on subsequent executions.

    – Salman A
    Mar 7 at 10:01






  • 1





    Note that tables have columns, not fields.

    – jarlh
    Mar 7 at 10:10






  • 1





    Bear in mind that updates affecting 0 rows are still interesting. Because e.g. they'll still cause triggers to fire.

    – Damien_The_Unbeliever
    Mar 7 at 10:37






  • 1





    field is an intersection of row and column, if a table has 10 rows and 10 columns then there is 100 fields

    – Ajan Balakumaran
    Mar 7 at 10:38
















0















Update T1 set T1.Field1 = y where T1.Field1 = x


Would this syntax work?



I want to update the field to equal 40 where that field is currently equal to 50. This would update several rows when run the first time.



I would hope that it would update zero rows when attempting to run it the second time.










share|improve this question

















  • 2





    Yes, it should work

    – dassoun
    Mar 7 at 9:59






  • 1





    ...and it'll update 0 rows on subsequent executions.

    – Salman A
    Mar 7 at 10:01






  • 1





    Note that tables have columns, not fields.

    – jarlh
    Mar 7 at 10:10






  • 1





    Bear in mind that updates affecting 0 rows are still interesting. Because e.g. they'll still cause triggers to fire.

    – Damien_The_Unbeliever
    Mar 7 at 10:37






  • 1





    field is an intersection of row and column, if a table has 10 rows and 10 columns then there is 100 fields

    – Ajan Balakumaran
    Mar 7 at 10:38














0












0








0








Update T1 set T1.Field1 = y where T1.Field1 = x


Would this syntax work?



I want to update the field to equal 40 where that field is currently equal to 50. This would update several rows when run the first time.



I would hope that it would update zero rows when attempting to run it the second time.










share|improve this question














Update T1 set T1.Field1 = y where T1.Field1 = x


Would this syntax work?



I want to update the field to equal 40 where that field is currently equal to 50. This would update several rows when run the first time.



I would hope that it would update zero rows when attempting to run it the second time.







sql syntax sql-update ssms






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 9:57









Dasal KalubowilaDasal Kalubowila

5312




5312







  • 2





    Yes, it should work

    – dassoun
    Mar 7 at 9:59






  • 1





    ...and it'll update 0 rows on subsequent executions.

    – Salman A
    Mar 7 at 10:01






  • 1





    Note that tables have columns, not fields.

    – jarlh
    Mar 7 at 10:10






  • 1





    Bear in mind that updates affecting 0 rows are still interesting. Because e.g. they'll still cause triggers to fire.

    – Damien_The_Unbeliever
    Mar 7 at 10:37






  • 1





    field is an intersection of row and column, if a table has 10 rows and 10 columns then there is 100 fields

    – Ajan Balakumaran
    Mar 7 at 10:38













  • 2





    Yes, it should work

    – dassoun
    Mar 7 at 9:59






  • 1





    ...and it'll update 0 rows on subsequent executions.

    – Salman A
    Mar 7 at 10:01






  • 1





    Note that tables have columns, not fields.

    – jarlh
    Mar 7 at 10:10






  • 1





    Bear in mind that updates affecting 0 rows are still interesting. Because e.g. they'll still cause triggers to fire.

    – Damien_The_Unbeliever
    Mar 7 at 10:37






  • 1





    field is an intersection of row and column, if a table has 10 rows and 10 columns then there is 100 fields

    – Ajan Balakumaran
    Mar 7 at 10:38








2




2





Yes, it should work

– dassoun
Mar 7 at 9:59





Yes, it should work

– dassoun
Mar 7 at 9:59




1




1





...and it'll update 0 rows on subsequent executions.

– Salman A
Mar 7 at 10:01





...and it'll update 0 rows on subsequent executions.

– Salman A
Mar 7 at 10:01




1




1





Note that tables have columns, not fields.

– jarlh
Mar 7 at 10:10





Note that tables have columns, not fields.

– jarlh
Mar 7 at 10:10




1




1





Bear in mind that updates affecting 0 rows are still interesting. Because e.g. they'll still cause triggers to fire.

– Damien_The_Unbeliever
Mar 7 at 10:37





Bear in mind that updates affecting 0 rows are still interesting. Because e.g. they'll still cause triggers to fire.

– Damien_The_Unbeliever
Mar 7 at 10:37




1




1





field is an intersection of row and column, if a table has 10 rows and 10 columns then there is 100 fields

– Ajan Balakumaran
Mar 7 at 10:38






field is an intersection of row and column, if a table has 10 rows and 10 columns then there is 100 fields

– Ajan Balakumaran
Mar 7 at 10:38













1 Answer
1






active

oldest

votes


















1














If I put this in simple words



Update T1 set T1.Field1 = y where T1.Field1 = x

Update T1 set T1.Field1 = 40 where T1.Field1 = 50


At first when your table has the value 50 for field1 and all those values will be updated as 40 when you run the update statement.



When you run this second time, now the column Field1 has already been updated as 40 and it's not 50 anymore so nothing will get affected since the update statement only updates 50 as 40.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55040848%2fsql-server-management-studio-update-t1-set-t1-field1-y-where-t1-field1-x-wou%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    If I put this in simple words



    Update T1 set T1.Field1 = y where T1.Field1 = x

    Update T1 set T1.Field1 = 40 where T1.Field1 = 50


    At first when your table has the value 50 for field1 and all those values will be updated as 40 when you run the update statement.



    When you run this second time, now the column Field1 has already been updated as 40 and it's not 50 anymore so nothing will get affected since the update statement only updates 50 as 40.






    share|improve this answer





























      1














      If I put this in simple words



      Update T1 set T1.Field1 = y where T1.Field1 = x

      Update T1 set T1.Field1 = 40 where T1.Field1 = 50


      At first when your table has the value 50 for field1 and all those values will be updated as 40 when you run the update statement.



      When you run this second time, now the column Field1 has already been updated as 40 and it's not 50 anymore so nothing will get affected since the update statement only updates 50 as 40.






      share|improve this answer



























        1












        1








        1







        If I put this in simple words



        Update T1 set T1.Field1 = y where T1.Field1 = x

        Update T1 set T1.Field1 = 40 where T1.Field1 = 50


        At first when your table has the value 50 for field1 and all those values will be updated as 40 when you run the update statement.



        When you run this second time, now the column Field1 has already been updated as 40 and it's not 50 anymore so nothing will get affected since the update statement only updates 50 as 40.






        share|improve this answer















        If I put this in simple words



        Update T1 set T1.Field1 = y where T1.Field1 = x

        Update T1 set T1.Field1 = 40 where T1.Field1 = 50


        At first when your table has the value 50 for field1 and all those values will be updated as 40 when you run the update statement.



        When you run this second time, now the column Field1 has already been updated as 40 and it's not 50 anymore so nothing will get affected since the update statement only updates 50 as 40.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 7 at 10:34

























        answered Mar 7 at 10:21









        Ajan BalakumaranAjan Balakumaran

        1,057412




        1,057412





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55040848%2fsql-server-management-studio-update-t1-set-t1-field1-y-where-t1-field1-x-wou%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved