UDT and temporary table

  • All,

    I am trying to make use of user-defined datatype in creating a temporary table. I don't want to use 'Select * into' to create the temp table. So, I issue a 'Create table #' and am using a user-defined datatype to define a column. SQL Server is giving an error when I try to run this stored procedure 'could not find the <datatype>'. If i create this datatype in tempdb then the proc. works. But, I am not sure if this is the right way to go about.

    Any Help...

    Thanks & Regards,

    Mitra

  • I believe the only way a temp table can take advantage of a user-defined datatype is for it to exist in the tempdb. The problem with this is each time the server restarts the tempdb is rebuilt so your datatype will dissappear. However if you need this datatype you can add it to model and each time the server restarts and tempdb is rebuilt it will return on it's own (like all databases tempdb uses model to build itself). The only downside is of course any new database you build will have this datatype in it.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply