Checking Temp Table in SQL Server
Hello to everyone,
In this article, I will give information about how to check temp table in SQL Server.
You may need to perform operations by checking whether the temp table exists in SQL Server.
You can provide temp table control using the code below.
--Example temp table creation
CREATE TABLE #MyTempTable
(
ID INT,
Name VARCHAR(20),
SurName VARCHAR(20)
);
--Checking if temp table exists
IF OBJECT_ID('tempdb..#MyTempTable') IS NOT NULL
BEGIN
PRINT 'There is a temp table';
END;
When you run the above code block, you will see the following result.
As you can see, we have a temp table, and as a result, we have a temp table.
Good luck to everyone in business and life.