{"id":17411,"date":"2022-08-16T13:03:02","date_gmt":"2022-08-16T11:03:02","guid":{"rendered":"https:\/\/expert-only.com\/?page_id=17411"},"modified":"2022-11-10T13:38:33","modified_gmt":"2022-11-10T12:38:33","slug":"manage-sql-server-views-with-t-sql-code","status":"publish","type":"page","link":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/","title":{"rendered":"Manage SQL Server views with T-SQL code"},"content":{"rendered":"\n<h4 class=\"has-text-align-center wp-block-heading\" id=\"h-scripts-to-manage-sql-server-views-create-call-modify-or-delete-views\"><strong><em>Scripts to manage SQL Server views: create, call, modify or delete views.<\/em><\/strong><\/h4>\n\n\n\n<p>Views are a powerful tool for structuring and displaying data, but how do you manage SQL Server views with scripts? Here created with Transact-SQL scripts, they offer several advantages. Views allow for example an abstraction on the data of an MS SQL database. In other words, creating different views allows you to display different sets of data without changing the structure of the underlying tables.<\/p>\n\n\n\n<p>Views can be created read-only and updated, and they can also be used to filter or aggregate data in a database. Views are useful for creating reports at an aggregated level. For example, to see the total revenue of all customers or the total orders of a company&#8217;s customers.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#1-definition-of-sql-server-views\" >1. Definition of SQL Server views<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#2-creating-the-source-table-of-the-views\" >2. Creating the source table of the views<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#3-create-a-sql-server-view-in-t-sql\" >3. Create a SQL Server view in T-SQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#4-modify-a-view-with-t-sql-code\" >4. Modify a view with T-SQL code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#5-drop-a-sql-server-view\" >5. Drop a SQL Server view<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#6-test-if-a-sql-view-exists-to-delete-it-without-error\" >6. Test if a SQL view exists to delete it without error<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#61-first-option-with-versions-older-than-sql-server-2016\" >6.1 First option with versions older than SQL Server 2016<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#62-second-option-with-ms-sql-2016-and-newer\" >6.2 Second option with MS SQL 2016 and newer<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#7-create-a-partitioned-view-using-union-all\" >7. Create a Partitioned View using UNION ALL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#8-create-a-sql-view-with-the-encryption-option\" >8. Create a SQL view with the encryption option<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1-definition-of-sql-server-views\"><\/span>1. Definition of SQL Server views<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In SQL (Structured Query Language), a view is an object that allows you to select a set of data. This data set comes from other tables or other views, which are themselves based on tables. The selection is made on the columns and rows. This means that it is possible to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Filter the rows vertically with a <strong><em>WHERE<\/em><\/strong> clause.<\/li>\n\n\n\n<li>And select columns horizontally or generate them in the <strong><em>SELECT<\/em><\/strong> clause.<\/li>\n<\/ul>\n\n\n\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/View_(SQL)\" target=\"_blank\" rel=\"noreferrer noopener\">SQL views<\/a> allow you to view all or part of the data contained in tables without directly accessing the content and structure of the table. They also allow you to aggregate data from multiple tables, by selecting columns with the same structures. The following are examples of code for creating, modifying, calling, or deleting simple views or partitioned views.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2-creating-the-source-table-of-the-views\"><\/span>2. Creating the source table of the views<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>All the example scripts below are based on this <a href=\"https:\/\/expert-only.com\/en\/t-sql\/create-table-sql-server\/\">sales table<\/a>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE TABLE [dbo].[SALES] \n(\n   [YearID] INT, \n   [MonthName] NVARCHAR(50), -- alphanumeric\n   [MonthCurrent] BIT, -- Boolean, 0 or 1 , false \/ true\n   [NumberMonth] TINYINT, -- very small integer, from 0 to 255\n   [EmployeeNumber] SMALLINT, -- small integer, minimum -2^15, maximum 2^15\n   [NumberOfClients] INTEGER, -- integer, minimum -2^31, maximum 2^31\n   [NumberOfSales] BIGINT, -- big integer, minimum: -2^63, maximum 2^63\n   [Amount_ET] NUMERIC(15,5), -- numeric, 15 digits, with 5 after the comma \n   [Amount_IT] DECIMAL(15,5) -- decimal, 15 digits, with 5 after the comma\n);\nGO<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3-create-a-sql-server-view-in-t-sql\"><\/span>3. Create a SQL Server view in T-SQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>First, here is an example of a T-SQL script to create a simple view based on the sales table whose code is available above. Here is how to create a SQL Server view with a script to aggregate and display the monthly sales for all customer data in the table with the sales made.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE VIEW [dbo].[V_Sales] \nAS \nSELECT \n   [MonthName], \n   [NumberOfClients], \n   [NumberOfSales], \n   [Amount_ET], \n   [Amount_IT] \nFROM    [dbo].[Sales];\nGO<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4-modify-a-view-with-t-sql-code\"><\/span>4. Modify a view with T-SQL code<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Second, use this sample <a href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-view-with-sql-server\/\">code to modify a view with ALTER VIEW<\/a>. Here is an example of T-SQL code to modify a view. Check the existence of the view beforehand to avoid errors when executing SQL code in SSMS.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> -- Remove the NumberOfClients column from the view\nALTER VIEW [dbo].[V_Sales] \nAS \nSELECT\n   [MonthName],\n   [NumberOfSales],\n   [Amount_ET], \n   [Amount_IT] \nFROM    [dbo].[Sales];\nGO<\/pre>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"MU7MkTsonM\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-view-with-sql-server\/\">Alter View with SQL Server<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Alter View with SQL Server&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/alter-view-with-sql-server\/embed\/#?secret=bZFIGRr7IN#?secret=MU7MkTsonM\" data-secret=\"MU7MkTsonM\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5-drop-a-sql-server-view\"><\/span>5. Drop a SQL Server view<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>However, to completely delete a view use the DROP VIEW command. Indeed, if the view does not exist, then the error Unable to find the object because it does not exist is displayed in the Database Management System (DBMS).<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">DROP VIEW [dbo].[V_Sales];\nGO<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6-test-if-a-sql-view-exists-to-delete-it-without-error\"><\/span>6. Test if a SQL view exists to delete it without error<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Indeed, it is advisable to test to avoid errors during the deletion of objects. To test the existence of views, use the IF EXISTS command and then the DROP command.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"61-first-option-with-versions-older-than-sql-server-2016\"><\/span>6.1 First option with versions older than SQL Server 2016<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The script is executed in two steps using the IF test and the <em>sys.objects<\/em> view to check if an object of View type exists in the current database.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">IF EXISTS (\n  SELECT 1 FROM sys.objects\n  WHERE  object_id = object_id(N'[dbo].[V_Sales]')\n    AND type in (N'V') )\nBEGIN \n  DROP VIEW [dbo].[V_Sales];\nEND;\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"62-second-option-with-ms-sql-2016-and-newer\"><\/span>6.2 Second option with MS SQL 2016 and newer<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Simply use the DOP VIEW IF EXISTS in one unique line of code.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">DROP VIEW IF EXISTS [dbo].[V_Sales];\nGO\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7-create-a-partitioned-view-using-union-all\"><\/span>7. Create a Partitioned View using UNION ALL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Similarly, to <a href=\"https:\/\/expert-only.com\/en\/t-sql\/create-partitioned-view-sql-server-group-tables\/\">combine data from multiple tables into a single partitioned view<\/a>, use this example. In principle, with a simple select query combined with a data union. Note that the three selections on the tables (or views) must have the same structure. Here the goal is to combine three years of data in a unique view, called <strong><em>V_Sales_P<\/em><\/strong>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE VIEW [dbo].[V_Sales_P]\nAS \n  SELECT [Year], [Month], [CustomerID], [SalesID], [Amount_ET], [Amount_IT]\n  FROM [dbo].[Sales_2020]\n  UNION ALL \n  SELECT [Year], [Month], [CustomerID], [SalesID], [Amount_ET], [Amount_IT]\n  FROM [dbo].[Sales_2021]\n  UNION ALL \n  SELECT [Year], [Month], [CustomerID], [SalesID], [Amount_ET], [Amount_IT]\n  FROM [dbo].[Sales_2022]\n;\nGO<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"8-create-a-sql-view-with-the-encryption-option\"><\/span>8. Create a SQL view with the encryption option<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Thus <a href=\"https:\/\/expert-only.com\/en\/t-sql\/create-sql-server-view-with-encryption\/\">encrypting a view simply hides the view code<\/a> in the <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/system-compatibility-views\/sys-syscomments-transact-sql?view=sql-server-ver16\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">sys.comments<\/a> system compatibility view. In this case, if the system uses Microsoft SQL replication, it does not publish the view.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><em>The encryption option does not encrypt data, but only the structure.<\/em><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> -- Remove the NumberOfClients column from the view\nALTER VIEW [dbo].[V_Sales_E]\nWITH ENCRYPTION \nAS \nSELECT \n   [MonthName], \n   [NumberOfClients], \n   [NumberOfSales], \n   [Amount_ET], \n   [Amount_IT] \nFROM    [dbo].[Sales];\nGO<\/pre>\n\n\n\n<p>This SQL Server tutorial explains how to manage views with T-SQL scripts. Views offer a lot of options and flexibility. It is therefore useful to use them extensively but useful in SQL development projects.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"yADuwzNR20\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/create-sql-server-view-with-encryption\/\">Create a SQL Server view with encryption<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Create a SQL Server view with encryption&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/create-sql-server-view-with-encryption\/embed\/#?secret=9AdfN7kXYO#?secret=yADuwzNR20\" data-secret=\"yADuwzNR20\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Scripts to manage SQL Server views: create, call, modify or delete views. Views are a powerful tool for structuring and displaying data, but how do you manage SQL Server views with scripts? Here created with Transact-SQL scripts, they offer <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/\" title=\"Manage SQL Server views with T-SQL code\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":6263,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-17411","page","type-page","status-publish","has-post-thumbnail"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Manage SQL Server views with T-SQL code - MS SQL Tutorials<\/title>\n<meta name=\"description\" content=\"Use T-SQL code to manage SQL Server views: create, display, modify or delete. Views are powerful objects for data structure and display.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Manage SQL Server views with T-SQL code\" \/>\n<meta property=\"og:description\" content=\"Use T-SQL code to manage SQL Server views: create, display, modify or delete. Views are powerful objects for data structure and display.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-10T12:38:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/hour-glass-sands-of-time-4F71097A077_1920x1080.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/\",\"url\":\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/\",\"name\":\"Manage SQL Server views with T-SQL code - MS SQL Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/hour-glass-sands-of-time-4F71097A077_1920x1080.jpeg\",\"datePublished\":\"2022-08-16T11:03:02+00:00\",\"dateModified\":\"2022-11-10T12:38:33+00:00\",\"description\":\"Use T-SQL code to manage SQL Server views: create, display, modify or delete. Views are powerful objects for data structure and display.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/hour-glass-sands-of-time-4F71097A077_1920x1080.jpeg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/hour-glass-sands-of-time-4F71097A077_1920x1080.jpeg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Manage SQL Server views with T-SQL code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Manage SQL Server views with T-SQL code - MS SQL Tutorials","description":"Use T-SQL code to manage SQL Server views: create, display, modify or delete. Views are powerful objects for data structure and display.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/","og_locale":"en_US","og_type":"article","og_title":"Manage SQL Server views with T-SQL code","og_description":"Use T-SQL code to manage SQL Server views: create, display, modify or delete. Views are powerful objects for data structure and display.","og_url":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_modified_time":"2022-11-10T12:38:33+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/hour-glass-sands-of-time-4F71097A077_1920x1080.jpeg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@expert_only","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/","url":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/","name":"Manage SQL Server views with T-SQL code - MS SQL Tutorials","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/hour-glass-sands-of-time-4F71097A077_1920x1080.jpeg","datePublished":"2022-08-16T11:03:02+00:00","dateModified":"2022-11-10T12:38:33+00:00","description":"Use T-SQL code to manage SQL Server views: create, display, modify or delete. Views are powerful objects for data structure and display.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/hour-glass-sands-of-time-4F71097A077_1920x1080.jpeg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/hour-glass-sands-of-time-4F71097A077_1920x1080.jpeg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/manage-sql-server-views-with-t-sql-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"Manage SQL Server views with T-SQL code"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/pages\/17411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=17411"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/pages\/17411\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/6263"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=17411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}