devxlogo

User-Defined Data Type in a Temporary Table

User-Defined Data Type in a Temporary Table

Question:
Can I use a user-defined data type when defining a temporary table in a stored procedure?

Answer:
You can use user-defined data types in temporary tables, but remember one caveat: the data type must be defined in the tempdb database. Temporary tables are created and dropped from tempdb, which is one of the system databases.

Even if you have the data type defined in the current database, you’ll receive an error saying it can’t find the data type.

devx-admin

Share the Post: