For those who move in the world of programming, Microsoft has always tried to make life easier by creating programs and systems that offer comfort. If you are one of these code and command programming enthusiasts, it is good that you learn how to create, modify or delete a view in SQL Server.
And it is that the world of programming and code is quite difficult and challenging. But that doesn’t stop new adventurers arriving who want to conquer the programs and become the best in their area, for this Microsoft is always inventing new things that they can get hooked on to work.
Create, modify or delete a view in SQL Server
In order not to confuse anyone, you have to go in parts, the first thing you will learn will be the creation of views in SQL server. To do this you just have to have the program already on your computer, if so, you have to proceed to open it and then in the “Object Explorer” you must expand the database where you want to create the view.
You will see there is a folder called “Views”, stand on it and right click with your mouse, then select “New View”.
Then, in the dialog box, click on the option called “Add table” here several tabs will appear that will allow you to choose the elements you want to add to the new view, these are: “Tables”, “Synonyms”, “Functions” and “Views”.
To add them, just click on the “Add” button and finish with “Close” to apply the changes. At the end of this go to the “Diagram panel” to place columns and other elements. Also go to “Criteria Panel” to place additional filters or sort criteria.
Finally go to the menu and in the “File” option click on “Save view name”, choose a name and press “OK” to save the view. With this you have already learned the first part of how to create, modify or delete a view in SQL Server, now comes the modification.
How to modify a view?
To change or modify a view you must go to the “Object Explorer” and from there select the + sign that is next to the view database, and then click the + sign that is next to the folder called “Views”. ”.
Here you will see all the views, you must right click on the one you will change and press the “Design” option that will appear, this will take you to the designer’s diagram panel. From here you can modify views in several ways:
Activating and deactivating the boxes of the elements that you want to remove or add, removing tables, among others. When you have finished click on “File” and “Save view name”.
Delete the blissful views
Now that you know two answers to the question How to create, modify or delete a view in SQL Server, it’s time to learn the last one, which would be to delete views.
To do this, go back to the “Object Explorer” and here expand both the database of the view you want to delete and the “Views” folder.
Once this is done, position yourself on the view you want to delete and right click on it, then press the “Delete” option, you will see a window called delete object where you must confirm the action by clicking on “OK”.
With the latter, everything will be solved so you can now say that you know how to create, modify or delete a view in SQL Server, you just have to put this simple tutorial into practice to start creating your projects.
Take into account if you are a novice, that the program is quite extensive and complicated, so you may need more tutorials to support you when you get into more advanced topics, such as: one that explains how to create stored procedures, another that shows you how to create databases, tables and records, one to connect two computers to a database, among others.