WHERE ID = OBJECT_ID ( N'tempdb.#Mytemp' ) Well its suggested you should Drop all the temporary objects you've created in your SQL for cleanup. (Temporary tables are getting created in TempDB in SQLServer.) Drop that table first otherwise you'll see error when you run the SQL. Now before using this statement in your SQL always place a check if table already exists in TempDB. I hope this article will help you achieving all the basics operations with Temporary tables.ĬREATE TABLE #Mytemp (Col1 nvarchar (100 ), Col2 int ) In this article we'll see how to use the Temporary tables and what are the necessary steps to be taken while using them and moreover sometimes it's required to add a column in Temporary tables dynamically. To do that there are options available in SQL Server you can use Cursors, #Temp tables or Table variables. While creating a stored procedure it's often necessary to create temporary tables to hold temporary operational data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |