When i open a view , when i simple click, ctrl+z, the already present code itself i getting deleted.

Arun 1 Reputation point

When a view or something is open to edit, only the newly added code is supposed to be deleted, when ctrl+z is clicked. but in my case, the whole code will get deleted, if i press it continueously.

SQL Server Management Studio 15.0.18390.0
SQL Server Management Objects (SMO) 16.100.46521.71
Microsoft Analysis Services Client Tools 15.0.19714.0
Microsoft Data Access Components (MDAC) 10.0.19041.1
Microsoft MSXML 3.0 6.0
Microsoft .NET Framework 4.0.30319.42000
Operating System 10.0.19043


There was lot of original code here, but it too is deleted, when i press ctrl+z

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,605 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Tom Phillips 17,716 Reputation points

  2. Erland Sommarskog 100.8K Reputation points MVP

    I guess that the "already present code" had been added while the window was open, so the undo cleared it all.

    I think we would need to see a video or something like that to be convinced that it is something else.

    0 comments No comments

  3. AmeliaGu-MSFT 13,961 Reputation points Microsoft Vendor

    Hi Arun-0441,

    I think SSMS may take your newly added code as a whole and delete it when using the undo action.
    You can go to click the down arrow next to the undo button to check if the newly added code is considered as insert text, which will cause your newly added code to be deleted at one time when using the undo action.


    Best Regards,

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments