Unanswered: How to share user-defined data type in different database?
I have defined a data type "OC_BUN_NAME" in database "CVPRO". I want to create a table tempdb.dbo.CVPRO in SQL SERVER 2005 system Database tempdb. But SQL SERVER 2005 DBMS gives a Error Messages:"Can not find the data type OC_BUN_NAME".
How can I do? How to use data types in the other database?
You should define the same data type in tempdb.
Also it would be good to define it in model database.
The tempdb is destroyed and recreated (from model) after each SQL Server restart. So if you define your data type in model database you do not have to redefine it in tempdb each time you reboot the server or restart SQL Server service.
However, after I define my data types in MODEL system databse, if I create a new database, the defined data types will automatically be added into the new database. I hope it can not happen. How can I do?
In SQL Server 2005, we can create a table in tempdb database so that different users can get access to data in the table. At the same time, when the SQL Server Services stop, tables created in tempdb database will be automatically destroyed. So in our project we want ot create a table in the tempdb database. However when we create the table, we can not use user-defined data type(the data types are defined in database "CVPRO"). Please give me some help.
If you want to use user-defined data type you need to define it in current database (database where you create the table).
Can't you use standard tables in your 'CVPRO' database and delete it when it is not used?
You can always create the SQL Server Agent job dropping not needed tables and schedule it to run daily at i.e. 11 PM...