{"id":9445,"date":"2022-08-04T11:14:55","date_gmt":"2022-08-04T09:14:55","guid":{"rendered":"https:\/\/expert-only.com\/?page_id=9445"},"modified":"2022-08-30T10:45:31","modified_gmt":"2022-08-30T08:45:31","slug":"manage-sql-server-tables","status":"publish","type":"page","link":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/","title":{"rendered":"Manage SQL Server tables"},"content":{"rendered":"\n<p>The tutorials in this section explains how to create and manage SQL Server tables. And shows the syntax by example. These queries allow you to manage SQL Server tables, which are the core of Microsoft&#8217;s relational databases.<\/p>\n\n\n\n<p>In other words, how to create, modify, copy, dump and delete one or more tables. That is, how to manipulate these objects with T-SQL commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-basic-sql-server-examples-for-creating-and-managing-tables\">Basic <mark>SQL Server<\/mark> examples for creating and managing tables<\/h2>\n\n\n\n<p>Here are some computer tutorials in French to manage tables stored in SQL Server, i.e. in the Microsoft DBMS. The first part explains the basic queries for management.<\/p>\n\n\n\n<p>The second part of the tutorials explains advanced concepts such as table partitioning for example.<\/p>\n\n\n\n<p>This example script uses the CREATE TABLE command to create a sales table. The script uses columns to store the time at month level, the employee number and the sales amounts.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">T-SQL example to create an MS SQL table<\/h3>\n\n\n\n<p>This table uses several data types to show a range of formats available with <a href=\"https:\/\/fr.wikipedia.org\/wiki\/Microsoft_SQL_Server\" target=\"_blank\" rel=\"noreferrer noopener\">SQL Server<\/a>. However, it also makes sense to calculate amounts on the fly with the VAT value stored once in another table, for example with the year.<\/p>\n\n\n\n<p>First, how do you create a SQL Server table with the CREATE TABLE command?<\/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=\"\">-- Test if the table already exists\n-- If it doaes then delete the table\nIF EXISTS(\n   SELECT 1 FROM sys.objects\n   WHERE object_id = object_id(N'[dbo].[SALES]')\n      AND type in (N'U')\n)\nDROP TABLE [dbo].[Sales]\nGO\n\n-- Create the example table to store SALES\nCREATE TABLE [dbo].[Sales] (\n   [MonthName] nvarchar(20),\n   [Amount] numeric(8)\n)\nGO\n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"697\" height=\"576\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/create-table-sql-server-script-1.jpg\" alt=\"Script to manage SQL tables with a CREATE TABLE SQL Server script\" class=\"wp-image-9004\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/create-table-sql-server-script-1.jpg 697w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/create-table-sql-server-script-1-300x248.jpg 300w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><figcaption>Script to manage SQL tables with a CREATE TABLE SQL Server script<\/figcaption><\/figure><\/div>\n\n\n<p>After the table creation, insert a few rows in the table to handle data for the first three months of the calendar year.<\/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=\"\">-- Insert sales data for our example\nINSERT INTO dbo.Sales (MonthName, Amount) VALUES ( N'January', 1000);\nINSERT INTO dbo.Sales (MonthName, Amount) VALUES ( N'February', 2000);\nINSERT INTO dbo.Sales (MonthName, Amount) VALUES ( N'March', 3000);\nGO\n\n-- Select results to check table contents\nSELECT    *\nFROM    dbo.Sales;\n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"438\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/sql-server-insert-into-table-script-1.jpg\" alt=\"Script to insert data into SQL Server tables with the INSERT INTO statement\" class=\"wp-image-9014\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/sql-server-insert-into-table-script-1.jpg 858w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/sql-server-insert-into-table-script-1-300x153.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/sql-server-insert-into-table-script-1-768x392.jpg 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><figcaption>Script to insert data into SQL Server tables with the INSERT INTO statement<\/figcaption><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Script to modify a table (ALTER TABLE)<\/h3>\n\n\n\n<p>Next, how to <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-alter-table\/\">modify a SQL Server table with ALTER<\/a> TABLE to add or remove a column for example. Or to change the size of a text field or the type of a column.<\/p>\n\n\n\n<p>First, to modify a table and add constraints to control the integrity of the data entered, use the ALTER TABLE and ADD CONSTRAINT commands.<\/p>\n\n\n\n<p>Add a constraint on the Sales table to check that the month name column is not null.<\/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=\"\">ALTER TABLE [dbo][SALES] WITH CHECK\nADD CONSTRAINT Month_check CHECK (MonthName IS NOT NULL);\nGO<\/pre>\n\n\n\n<p>It is now possible to insert only non-zero values for the month column into the sales table.<\/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=\"\">-- Insert three more rows in the sales table\nINSERT INTO [DBO].[SALES] VALUES ('March', 1000);\nINSERT INTO [DBO].[SALES] VALUES ('April', 2000);\nINSERT INTO [DBO].[SALES] VALUES ('May', 3000);\n\n-- This line will not be inserted because there is a null value for the month\nINSERT INTO [DBO].[SALES] VALUES (null, 5000);\n<\/pre>\n\n\n\n<p>If the month is null then this SQL Server error appears:<\/p>\n\n\n\n<p><em>The INSERT statement conflicted with the CHECK constraint &#8220;Month_check&#8221;.<br>The conflict occurred in database &#8220;Expert-Only&#8221;, table &#8220;dbo.SALES&#8221;, column &#8216;MonthName&#8217;.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">INSERT INTO query from a SELECT with SQL Server<\/h3>\n\n\n\n<p>To go further and insert rows from a selection query, use the <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-insert-into-from-a-select\/\">Insert Into query directly from a SELECT<\/a> statement.<\/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=\"\">INSERT INTO [dbo].[SALES] ([MonthName], [Amount])\nSELECT N'January', '1', 1000 UNION ALL\nSELECT N'February', '2', 2000 UNION ALL\nSELECT N'March', '3', 3000;\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Adding a column to a SQL table (ALTER COLUMN)<\/h3>\n\n\n\n<p>Then, to evolve a table, adapt this example to change the length of the columns with an ALTER COLUMN script.<\/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=\"\">-- Change the length of the month name from 20 to 100 characters\nALTER TABLE [dbo].[SALES].\nALTER COLUMN [MonthName] NVARCHAR(100);\nGO<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Deleting data from a SQL table with Microsoft (DELETE FROM)<\/h3>\n\n\n\n<p>Third, to delete data with a filter, use this script and adapt it to the needs of the project. This script deletes the data for the first three months, January, February and March.<\/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=\"\">DELETE FROM [DBO][SALES]\nWHERE MonthName in ('January', 'February', 'March');\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Empty all data from an MSSQL table (TRUNCATE TABLE)<\/h3>\n\n\n\n<p>Furthermore, before completely deleting a table and thus the contents and structure, it is possible to <a href=\"https:\/\/expert-only.com\/en\/t-sql\/empty-sql-server-table-truncate\/\">empty the contents of the MS SQL table with the TRUNCATE TABLE<\/a> command.<\/p>\n\n\n\n<p>To clear all data from a SQL Server table without any filters, use the TRUNCATE TABLE script.<\/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=\"\">TRUNCATE TABLE [dbo].[SALES];\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Check if a table exists and delete it (IF EXISTS and DROP TABLE)<\/h3>\n\n\n\n<p>It is possible <a href=\"https:\/\/expert-only.com\/en\/t-sql\/check-if-table-exists-in-sql-server\/\">to test if a SQL Server table exists before deleting it<\/a> to avoid errors like &#8220;<a href=\"https:\/\/expert-only.com\/en\/sql-server-error\/cannot-find-the-object-because-it-does-not-exist\/\">Can&#8217;t find the object because it doesn&#8217;t exist or you don&#8217;t have the necessary permissions<\/a>&#8220;?<\/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\tSELECT 1 FROM sys.objects\n\tWHERE object_id = object_id(N'[dbo].[SALES]')\n\tAND type in (N'U') )\nBEGIN\n\tDROP TABLE [dbo].[SALES]\nEND;\nGO\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Delete a SQL Server table (DROP TABLE)<\/h3>\n\n\n\n<p>To completely delete a SQL Server table, use the T-SQL DROP TABLE command. This means that the structure and contents are deleted. Note that this action is irreversible and that it is therefore necessary to save the code of the table beforehand.<\/p>\n\n\n\n<p>Use this T-SQL command to delete a SQL Server table, i.e. the contents of the table and its structure.<\/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 TABLE [dbo].[SALES];\nGO<\/pre>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-tutoriels-sql-et-it wp-block-embed-tutoriels-sql-et-it\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"tPkrp2XB4e\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/check-if-table-exists-in-sql-server\/\">Check if table exists in 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;Check if table exists in SQL Server&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/check-if-table-exists-in-sql-server\/embed\/#?secret=MCtv2TwLqx#?secret=tPkrp2XB4e\" data-secret=\"tPkrp2XB4e\" 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\">Administer and optimize query performance on SQL Server tables<\/h2>\n\n\n\n<p>This second part on SQL tables deals with advanced topics. For example, listing certain objects and their characteristics or optimizing query performance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create a SQL table with a primary key<\/h3>\n\n\n\n<p>A primary key is used to uniquely identify a row in a table. Here is a <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-primary-key\/\">script to create a table and define a column as a primary key<\/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].[Customers](\n   [CustomerID] [int] NOT NULL,\n   [FirstName] [nvarchar](20) NULL,\n   [LastName] [nvarchar](20) NULL,\n   [City] [nvarchar](20) NULL,\n   [Country] [nvarchar](50) NULL,\n   CONSTRAINT [CustomersPrimaryKeyCustomerID] PRIMARY KEY CLUSTERED ([CustomerID] ASC)\n);\nGO<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a SQL Server table with partitions<\/h3>\n\n\n\n<p>To improve performance it is possible to create a SQL Server table with partitions. Indeed, the SQL partitioning allows to separate the data of a same table on different groups of independent files. The data is split according to the value of a column.<\/p>\n\n\n\n<p>This intelligent partitioning allows for optimised performance each time the partitioning column is used in a query.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Display a list with the size of the MSSQL tables and the disk space used<\/h3>\n\n\n\n<p>Here is a short tutorial to <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-table-size-disk-space\/\">list the tables with their size and the disk space used<\/a> by each object.<\/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=\"\">SELECT\n     sch.name as SchemaName,\n     tab.name as TableName,\n     par.rows as RowCounts, \n     sum(alc.total_pages) * 8 as TotalSpace,\n     sum(alc.used_pages) * 8 as UsedSpace,\n     (sum(alc.total_pages) - sum(alc.used_pages)) * 8 as UnusedSpace\nFROM sys.tables tab \nINNER JOIN sys.indexes ind \n     ON tab.object_id = ind.object_id \nINNER JOIN sys.partitions par \n     ON ind.object_id = par.object_id \n     and ind.index_id = par.index_id \nINNER JOIN sys.allocation_units alc \n     ON par.partition_id = alc.container_id \nLEFT OUTER JOIN sys.schemas sch \n     ON tab.schema_id = sch.schema_id \nGROUP BY \n     tab.name, \n     sch.name, \n     par.rows \nORDER BY 1,2;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">SQL query to list user-defined table types<\/h3>\n\n\n\n<p>This SQL tutorial explains <a href=\"https:\/\/expert-only.com\/en\/t-sql\/list-user-defined-table-types-sql-server\/\">how to list user-defined table types with a T-SQL script<\/a>. These User Defined Tables (UDT) are objects of type table. Or to be more precise, table variables.<\/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=\"\">SELECT\n     name, \n     system_type_id, \n     user_type_id, \n     schema_id, \n     principal_id, \n     max_length, \n     precision, \n     scale, \n     collation_name, \n     is_nullable, \n     is_user_defined, \n     is_assembly_type, \n     default_object_id, \n     rule_object_id, \n     is_table_type\nFROM      SYS.TABLE_TYPES\nWHERE      IS_USER_DEFINED = 1;\n<\/pre>\n\n\n\n<p>Finally, these simple query examples show how to create, delete, modify, dump, delete or optimise SQL tables.<\/p>\n\n\n\n<p>This article, which I recommend to keep as a favorite and to share, reminds the basic syntaxes on SQL Server tables.<\/p>\n\n\n\n<p>Moreover, the details of each operation are not listed here, because the objective is to have the syntax at hand as quickly as possible.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-tutoriels-sql-et-it wp-block-embed-tutoriels-sql-et-it\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"VHHsdVO0Cd\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/list-user-defined-table-types-sql-server\/\">List user defined table types in SQL Server (UDT)<\/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;List user defined table types in SQL Server (UDT)&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/list-user-defined-table-types-sql-server\/embed\/#?secret=exIu2Yncck#?secret=VHHsdVO0Cd\" data-secret=\"VHHsdVO0Cd\" 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>The tutorials in this section explains how to create and manage SQL Server tables. And shows the syntax by example. These queries allow you to manage SQL Server tables, which are the core of Microsoft&#8217;s relational databases. In other <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/\" title=\"Manage SQL Server tables\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":5657,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-9445","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 tables - T-SQL tutorials<\/title>\n<meta name=\"description\" content=\"Tutorials to create and manage SQL Server tables with T-SQL queries to add, modify, delete, insert and optimize MSSQL tables.\" \/>\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-tables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Manage SQL Server tables\" \/>\n<meta property=\"og:description\" content=\"Tutorials to create and manage SQL Server tables with T-SQL queries to add, modify, delete, insert and optimize MSSQL tables.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/\" \/>\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-08-30T08:45:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/light-bulb-B4BACF3D6C0_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=\"7 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-tables\/\",\"url\":\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/\",\"name\":\"Manage SQL Server tables - T-SQL tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/light-bulb-B4BACF3D6C0_1920x1080.jpeg\",\"datePublished\":\"2022-08-04T09:14:55+00:00\",\"dateModified\":\"2022-08-30T08:45:31+00:00\",\"description\":\"Tutorials to create and manage SQL Server tables with T-SQL queries to add, modify, delete, insert and optimize MSSQL tables.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/light-bulb-B4BACF3D6C0_1920x1080.jpeg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/light-bulb-B4BACF3D6C0_1920x1080.jpeg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Manage SQL Server tables\"}]},{\"@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 tables - T-SQL tutorials","description":"Tutorials to create and manage SQL Server tables with T-SQL queries to add, modify, delete, insert and optimize MSSQL tables.","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-tables\/","og_locale":"en_US","og_type":"article","og_title":"Manage SQL Server tables","og_description":"Tutorials to create and manage SQL Server tables with T-SQL queries to add, modify, delete, insert and optimize MSSQL tables.","og_url":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_modified_time":"2022-08-30T08:45:31+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/light-bulb-B4BACF3D6C0_1920x1080.jpeg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@expert_only","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/","url":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/","name":"Manage SQL Server tables - T-SQL tutorials","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/light-bulb-B4BACF3D6C0_1920x1080.jpeg","datePublished":"2022-08-04T09:14:55+00:00","dateModified":"2022-08-30T08:45:31+00:00","description":"Tutorials to create and manage SQL Server tables with T-SQL queries to add, modify, delete, insert and optimize MSSQL tables.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/manage-sql-server-tables\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/light-bulb-B4BACF3D6C0_1920x1080.jpeg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/light-bulb-B4BACF3D6C0_1920x1080.jpeg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"Manage SQL Server tables"}]},{"@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\/9445","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=9445"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/pages\/9445\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/5657"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=9445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}