{"id":10201,"date":"2022-08-22T05:34:00","date_gmt":"2022-08-22T03:34:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=10201"},"modified":"2023-01-30T18:54:37","modified_gmt":"2023-01-30T17:54:37","slug":"manage-sql-server-temporary-tables","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/","title":{"rendered":"Manage SQL Server temporary tables using T-SQL code"},"content":{"rendered":"\n<p class=\"has-text-align-center\"><strong><em>How to create and manage <strong><em>SQL Server<\/em><\/strong><\/em><\/strong> <strong><em>temporary tables with T-SQL code?<\/em><\/strong><\/p>\n\n\n\n<p>SSMS and T-SQL provides the options to manage SQL Server temporary tables. These objects can be used to store intermediate results during complex T-SQL code execution. Temporary tables can be a valuable tool for optimizing performance and simplifying code, but managing them can be challenging.<\/p>\n\n\n\n<p>In this blog post, we will explore how to effectively manage temporary tables using T-SQL code, including creation, population, manipulation, and deletion of these tables. Hence to provide a better understanding of the benefits and limitations of temporary tables and the T-SQL techniques required to effectively use them database operations.<\/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\/t-sql\/manage-sql-server-temporary-tables\/#1-what-is-a-sql-server-temporary-table\" >1. What is a SQL Server temporary table?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#11-differences-between-a-permanent-and-a-temporary-table\" >1.1 Differences between a permanent and a temporary table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#12-main-characteristics-of-temp-tables-in-t-sql-projects\" >1.2 Main characteristics of temp tables in T-SQL projects<\/a><\/li><\/ul><\/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\/t-sql\/manage-sql-server-temporary-tables\/#2-manage-local-temporary-tables-overview\" >2. Manage local temporary tables overview<\/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\/t-sql\/manage-sql-server-temporary-tables\/#3-create-a-local-temporary-table\" >3. Create a local temporary table<\/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\/t-sql\/manage-sql-server-temporary-tables\/#4-drop-a-local-temporary-table\" >4. Drop a local temporary table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#5-drop-a-local-temp-table-with-a-sql-server-version-before-2016\" >5. Drop a local temp table with a SQL Server version before 2016<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#6-global-temporary-tables-overview\" >6. Global temporary tables overview<\/a><\/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\/t-sql\/manage-sql-server-temporary-tables\/#7-create-a-global-temporary-table\" >7. Create a global temporary table<\/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\/t-sql\/manage-sql-server-temporary-tables\/#8-drop-a-global-temporary-table\" >8. Drop a global temporary table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#9-drop-a-global-temp-table-with-sql-server-version-before-2016\" >9. Drop a global temp table with SQL Server version before 2016<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#10-list-all-temporary-tables-of-the-instance\" >10. List all temporary tables of the instance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#11-complete-use-case-using-multiple-temporary-tables\" >11. Complete use case using multiple temporary tables<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#12-pros-and-cons-of-using-sql-server-temporary-tables\" >12. Pros and Cons of using SQL Server temporary tables<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#121-benefits-of-temporary-tables-in-t-sql-queries\" >12.1 Benefits of temporary tables in T-SQL queries<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#122-limitations-of-temporary-tables-in-sql-server\" >12.2 Limitations of temporary tables in SQL Server<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#13-conclusion-on-sql-server-temporary-tables\" >13. Conclusion on SQL Server temporary tables<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-what-is-a-sql-server-temporary-table\"><span class=\"ez-toc-section\" id=\"1-what-is-a-sql-server-temporary-table\"><\/span>1. What is a SQL Server temporary table?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>SQL Server temp tables are temporary tables that are used for storing data temporarily. They are created with the <a href=\"https:\/\/expert-only.com\/en\/t-sql\/create-table-sql-server\/\">CREATE TABLE command in T-SQL<\/a>. In MS SQL tutorial, we will learn about SQL Server temp tables and what they are used for. There are two types of temp tables, the local temporary tables, and the global temporary tables. We will also go over how to create them and insert data into them.<\/p>\n\n\n\n<p>SQL is a programming language designed for managing data in relational database management systems. SQL statements are used to create, read, update, and delete data in the database, and the main object used is the table. A temporary table is a table created in SQL Server for the purpose of storing temporary data that will be used only during the duration of a single session.<\/p>\n\n\n\n<p>Temporary tables are deleted when you exit your <a href=\"https:\/\/expert-only.com\/en\/ssms\/download-sql-server-management-studio-18-ssms\/\">SQL Server Management Studio<\/a> session or when you execute <a href=\"https:\/\/expert-only.com\/en\/t-sql\/drop-a-table-in-sql-server\/\">DROP TABLE<\/a> on them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-1-differences-between-a-permanent-and-a-temporary-table\"><span class=\"ez-toc-section\" id=\"11-differences-between-a-permanent-and-a-temporary-table\"><\/span>1.1 Differences between a permanent and a temporary table<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><em>What is the difference between a permanent and a temporary table in SQL Server?<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A permanent table is created when a user first creates it and is only dropped explicitly. So, it remains in the database. It is stored on the disk, and it is backed up if backups are active on the SQL server database.<\/li>\n\n\n\n<li>Temporary tables are also created with a simple SQL create statement, but they are dropped after the end of a stored procedure, or after the session is closed or after all tasks referencing the table is closed (for global temporary tables).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-2-main-characteristics-of-temp-tables-in-t-sql-projects\"><span class=\"ez-toc-section\" id=\"12-main-characteristics-of-temp-tables-in-t-sql-projects\"><\/span>1.2 Main characteristics of temp tables in T-SQL projects<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The main goal and benefit of temporary tables is to store intermediate result sets of queries. These results sets are not stored on disk and in memory. Temporary tables can be created to store data from a single or multiple queries. However, do not use temporary tables for long-term storage or for frequently accessed data.<\/p>\n\n\n\n<p>A version of the MS SQL tutorial is available in video on the <a href=\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\" target=\"_blank\" rel=\"noreferrer noopener\">Youtube Channel of the blog<\/a>:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to create and manage SQL Server temporary tables?\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/gmh2clNMoB8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-manage-local-temporary-tables-overview\"><span class=\"ez-toc-section\" id=\"2-manage-local-temporary-tables-overview\"><\/span>2. Manage local temporary tables overview<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>A local temporary table can be created and called inside a stored procedure. In this case, the same stored procedure can be called at the same time without interference. The <a href=\"https:\/\/expert-only.com\/en\/sql-server-db\/create-database-ssms\/\">MS SQL database<\/a> engine distinguish the tables by adding a numeric suffix at the end of the table name, the numeric suffix is listed in the <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/system-compatibility-views\/sys-sysobjects-transact-sql?view=sql-server-ver16\" target=\"_blank\" rel=\"noreferrer noopener\">sys.sysobjects system table<\/a>. Local temporary tables are stored in tempdb on the same instance as the database that created them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-create-a-local-temporary-table\"><span class=\"ez-toc-section\" id=\"3-create-a-local-temporary-table\"><\/span>3. Create a local temporary table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>All temp tables are created in the dbo schema so it is useless to indicate a specific schema. To create a local temporary table, simply execute a query like this one.<\/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 a sales local temporary table\n-- with two columns\nCREATE TABLE #Sales_Temp (\n   [MonthName]   nvarchar(20),\n   [Amount]      numeric(8)\n);\nGO\n\n-- Insert sales data for the first\n-- three month of the year\nINSERT INTO #Sales_Temp (MonthName, Amount)\nVALUES ( N'January', 1000);\nINSERT INTO #Sales_Temp (MonthName, Amount)\nVALUES ( N'February', 2000);\nINSERT INTO #Sales_Temp (MonthName, Amount)\nVALUES ( N'March', 3000);\nGO\n\n-- script provided by https:\/\/expert-only.com <\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"680\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/create-local-temporary-table-sql-server.jpg\" alt=\"Create a local temporary table with a SQL Server script\" class=\"wp-image-10185\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/create-local-temporary-table-sql-server.jpg 640w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/create-local-temporary-table-sql-server-282x300.jpg 282w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><figcaption class=\"wp-element-caption\">Create a local temporary table with a SQL Server script<\/figcaption><\/figure><\/div>\n\n\n<p>However, it is also possible to create a temporary table outside a stored procedure, like for example in a simple T-SQL statement. Then there is a way to avoid errors if a stored procedure has the exact same name inside a procedure.<\/p>\n\n\n\n<p>It is recommended to check and drop any existing temp table in the database, even if they are not permanent.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-4-drop-a-local-temporary-table\"><span class=\"ez-toc-section\" id=\"4-drop-a-local-temporary-table\"><\/span>4. Drop a local temporary table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To drop a local temporary table, use this syntax:<\/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 IF EXISTS #Sales_Temp; \nGO<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-5-drop-a-local-temp-table-with-a-sql-server-version-before-2016\"><span class=\"ez-toc-section\" id=\"5-drop-a-local-temp-table-with-a-sql-server-version-before-2016\"><\/span>5. Drop a local temp table with a SQL Server version before 2016<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>For the SQL server version before the 2016 release, use this statement, because the DROP TABLE IF EXISTS was introduced in the MS SQL 2016 version :<\/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 OBJECT_ID('#Sales_Temp', 'U') IS NOT NULL\n   DROP TABLE #Sales_Temp;\nGO<\/pre>\n\n\n\n<p>Here is another <a href=\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/\">IT tutorial for managing classic SQL Server tables<\/a> this time, i.e. permanent tables.<\/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=\"LI16S0NyvJ\"><a href=\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/\">Manage SQL Server tables<\/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;Manage SQL Server tables&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/manage-sql-server-tables\/embed\/#?secret=pyHy6ubDpr#?secret=LI16S0NyvJ\" data-secret=\"LI16S0NyvJ\" 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\" id=\"h-6-global-temporary-tables-overview\"><span class=\"ez-toc-section\" id=\"6-global-temporary-tables-overview\"><\/span>6. Global temporary tables overview<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>On the other hand, the global temporary tables are only dropped after all tasks on the table are finished. In other words, it will be deleted from the system after the last T-SQL query is finished on the same session that created the table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-7-create-a-global-temporary-table\"><span class=\"ez-toc-section\" id=\"7-create-a-global-temporary-table\"><\/span>7. Create a global temporary table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This script allows you to create a simple global temporary 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=\"\">-- Create a sales global temporary table\n-- with two columns\nCREATE TABLE ##Sales_Global (\n   [MonthName]   nvarchar(20),\n   [Amount]      numeric(8)\n);\nGO\n\n-- Insert sales data for the first\n-- three month of the year\nINSERT INTO ##Sales_Global (MonthName, Amount)\nVALUES ( N'January', 1000);\nINSERT INTO ##Sales_Global (MonthName, Amount)\nVALUES ( N'February', 2000);\nINSERT INTO ##Sales_Global (MonthName, Amount)\nVALUES ( N'March', 3000);\nGO\n\n-- fournit par https:\/\/expert-only.com <\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"680\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/create-global-temporary-table-sql-server.jpg\" alt=\"Create a global temporary table with a SQL Server script\" class=\"wp-image-10191\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/create-global-temporary-table-sql-server.jpg 640w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/create-global-temporary-table-sql-server-282x300.jpg 282w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><figcaption class=\"wp-element-caption\">Create a global temporary table with a SQL Server script<\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-8-drop-a-global-temporary-table\"><span class=\"ez-toc-section\" id=\"8-drop-a-global-temporary-table\"><\/span>8. Drop a global temporary table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To check if a temp table exists and drop it at the same time, without error, use a query like this one: <\/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 IF EXISTS ##Sales_Global ;\nGO<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-9-drop-a-global-temp-table-with-sql-server-version-before-2016\"><span class=\"ez-toc-section\" id=\"9-drop-a-global-temp-table-with-sql-server-version-before-2016\"><\/span>9. Drop a global temp table with SQL Server version before 2016<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To check if the table exists and drop it in versions anterior to 2016, use this example: <\/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 OBJECT_ID('##Sales_Global','U') IS NOT NULL\n   DROP TABLE #Sales_Global;\nGO<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-10-list-all-temporary-tables-of-the-instance\"><span class=\"ez-toc-section\" id=\"10-list-all-temporary-tables-of-the-instance\"><\/span>10. List all temporary tables of the instance<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>First, to list all the temporary table created on the SQL Server instance, use this T-SQL query:<\/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 * FROM tempdb.sys.sysobjects\nWHERE [name] like '#%'\nORDER BY [name];<\/pre>\n\n\n\n<p>Second, to list only the local temporary table created on the SQL Server instance, use this T-SQL 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=\"\">SELECT * FROM tempdb.sys.sysobjects\nWHERE   [name] like '#%' \nAND   [name] not like '##%'\nORDER BY [name];<\/pre>\n\n\n\n<p>Third, to list only the global temporary table created on the current instance, use this T-SQL example:<\/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 * FROM tempdb.sys.sysobjects\nWHERE [name] like '##%'\nORDER BY [name];<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"11-complete-use-case-using-multiple-temporary-tables\"><\/span>11. Complete use case using multiple temporary tables<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>For example, <strong>to create a very complex transformation<\/strong> using data multiple tables and views, and you only need to store the result. For example, you need to <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-pivot-example\/\">pivot a table<\/a>, then calculate an average and sum them up, and then dispatch the data using a ratio on different dates. Then using intermediate table is easier than a very large and complex <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-stored-procedure\/\">stored procedure with T-SQL<\/a> in one shot.<\/p>\n\n\n\n<p>We recommend to split the following code code into steps inside one or multiple stored procedures. For example, let&#8217;s use these 4 local temporary tables:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>#temp_1_pivot<\/li>\n\n\n\n<li>#temp_2_average<\/li>\n\n\n\n<li>#temp_3_group_by_year<\/li>\n\n\n\n<li>#temp_4_ratio<\/li>\n<\/ul>\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 temp table #temp_1_pivot\nCREATE TABLE #temp_1_pivot (\n    ProductID INT,\n    Year INT,\n    Sales INT\n);\n\nINSERT INTO #temp_1_pivot (ProductID, Year, Sales)\nVALUES\n    (1, 2020, 110),\n    (1, 2021, 150),\n    (1, 2022, 190),\n    (2, 2020, 50),\n    (2, 2021, 75),\n    (2, 2022, 125),\n    (3, 2020, 75),\n    (3, 2021, 125),\n    (3, 2022, 175),\n    (4, 2020, 60),\n    (4, 2021, 90),\n    (4, 2022, 80);\n\n-- Create temp table #temp_2_average\nCREATE TABLE #temp_2_average (\n    ProductID INT,\n    AverageSales INT\n);\n\n-- Populate #temp_2_average with average sales by product ID\nINSERT INTO #temp_2_average\nSELECT \n    ProductID,\n    AVG(Sales) AS AverageSales\nFROM \n    #temp_1_pivot\nGROUP BY \n    ProductID;\n\n-- Create temp table #temp_3_group_by_year\nCREATE TABLE #temp_3_group_by_year (\n    Year INT,\n    TotalSales INT\n);\n\n-- Populate #temp_3_group_by_year with total sales by year\nINSERT INTO #temp_3_group_by_year\nSELECT \n    Year,\n    SUM(Sales) AS TotalSales\nFROM \n    #temp_1_pivot\nGROUP BY \n    Year;\n\n-- Create temp table #temp_4_ratio\nCREATE TABLE #temp_4_ratio (\n    Year INT,\n    SalesRatio FLOAT\n);\n\n-- Populate #temp_4_ratio with the sales ratio by year\nINSERT INTO #temp_4_ratio\nSELECT \n    t3.Year,\n    (t3.TotalSales \/ (SELECT SUM(TotalSales) FROM #temp_3_group_by_year)) AS SalesRatio\nFROM \n    #temp_3_group_by_year t3;\n\n-- Display the results from the temp tables\nSELECT * FROM #temp_1_pivot;\nSELECT * FROM #temp_2_average;\nSELECT * FROM #temp_3_group_by_year;\nSELECT * FROM #temp_4_ratio;\n\n-- Drop the temp tables\nDROP TABLE #temp_1_pivot;\nDROP TABLE #temp_2_average;\nDROP TABLE #temp_3_group_by_year;\nDROP TABLE #temp_4_ratio;\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"12-pros-and-cons-of-using-sql-server-temporary-tables\"><\/span>12. Pros and Cons of using SQL Server temporary tables <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-12-1-benefits-of-temporary-tables-in-t-sql-queries\"><span class=\"ez-toc-section\" id=\"121-benefits-of-temporary-tables-in-t-sql-queries\"><\/span>12.1 Benefits of temporary tables in T-SQL queries<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This a short list, not exhaustive of the temporary table benefits:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Store intermediate results for complex data operations.<\/li>\n\n\n\n<li>Store the results of a repeatedly executed query. Caching data allows for one-time computation and storage and increases performance. It is therefore an ideal workspace for processing large amounts of data.<\/li>\n\n\n\n<li>Local temporary tables are created in the tempdb system database and are not visible outside the session in which they were created.<\/li>\n\n\n\n<li>The database engine automatically manages temporary tables.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-12-2-limitations-of-temporary-tables-in-sql-server\"><span class=\"ez-toc-section\" id=\"122-limitations-of-temporary-tables-in-sql-server\"><\/span>12.2 Limitations of temporary tables in SQL Server<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The temp tables in SQL Server do not support foreign keys. If a foreign key is used in the creation script, the execution will not fail but the key will not be created, and the database engine will display a warning message.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"13-conclusion-on-sql-server-temporary-tables\"><\/span>13. Conclusion on SQL Server temporary tables<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In conclusion, temporary tables provide a convenient way to store and manage intermediate data during complex T-SQL operations. By utilizing the <code>CREATE TABLE<\/code> and <code>INSERT INTO<\/code> statements, it is possible to dynamically create and populate temporary tables in SQL Server.<\/p>\n\n\n\n<p>The use of temporary tables can improve the efficiency and organization of T-SQL code, making it easier to maintain and debug. With the knowledge and techniques discussed in this blog post, you can now effectively manage temporary tables in your SQL Server projects.<\/p>\n\n\n\n<p>This tutorial on how to manage SQL Server temporary tables, whether local or global, explains how to create them, insert data, delete them and list them from system tables. Here is another tutorial on <a href=\"https:\/\/expert-only.com\/en\/t-sql\/query-list-all-sql-server-tables\/\">how to list all tables in a SQL Server database<\/a>.<\/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\">\nhttps:\/\/expert-only.com\/en\/t-sql\/query-list-all-sql-server-tables\/\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>How to create and manage SQL Server temporary tables with T-SQL code? SSMS and T-SQL provides the options to manage SQL Server temporary tables. These objects can be used to store intermediate results during complex T-SQL code execution. Temporary <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/\" title=\"Manage SQL Server temporary tables using T-SQL code\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":5833,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-10201","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"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 temporary tables - SQL objects - T-SQL<\/title>\n<meta name=\"description\" content=\"To manage local or global SQL Server temporary tables with T-SQL code, use a Create Table statement and hash characters before the name.\" \/>\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\/t-sql\/manage-sql-server-temporary-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 temporary tables using T-SQL code\" \/>\n<meta property=\"og:description\" content=\"To manage local or global SQL Server temporary tables with T-SQL code, use a Create Table statement and hash characters before the name.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-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:published_time\" content=\"2022-08-22T03:34:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-30T17:54:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_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=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"Manage SQL Server temporary tables using T-SQL code\",\"datePublished\":\"2022-08-22T03:34:00+00:00\",\"dateModified\":\"2023-01-30T17:54:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/\"},\"wordCount\":1306,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/\",\"name\":\"Manage SQL Server temporary tables - SQL objects - T-SQL\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg\",\"datePublished\":\"2022-08-22T03:34:00+00:00\",\"dateModified\":\"2023-01-30T17:54:37+00:00\",\"description\":\"To manage local or global SQL Server temporary tables with T-SQL code, use a Create Table statement and hash characters before the name.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Manage SQL Server temporary tables using 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\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Manage SQL Server temporary tables - SQL objects - T-SQL","description":"To manage local or global SQL Server temporary tables with T-SQL code, use a Create Table statement and hash characters before the name.","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\/t-sql\/manage-sql-server-temporary-tables\/","og_locale":"en_US","og_type":"article","og_title":"Manage SQL Server temporary tables using T-SQL code","og_description":"To manage local or global SQL Server temporary tables with T-SQL code, use a Create Table statement and hash characters before the name.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2022-08-22T03:34:00+00:00","article_modified_time":"2023-01-30T17:54:37+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"Manage SQL Server temporary tables using T-SQL code","datePublished":"2022-08-22T03:34:00+00:00","dateModified":"2023-01-30T17:54:37+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/"},"wordCount":1306,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/","url":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/","name":"Manage SQL Server temporary tables - SQL objects - T-SQL","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg","datePublished":"2022-08-22T03:34:00+00:00","dateModified":"2023-01-30T17:54:37+00:00","description":"To manage local or global SQL Server temporary tables with T-SQL code, use a Create Table statement and hash characters before the name.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/06\/life_dark_river-432893F7EFD_1920x1080.jpeg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-temporary-tables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"Manage SQL Server temporary tables using 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"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/10201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"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=10201"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/10201\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/5833"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=10201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=10201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=10201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}