Table of user defined type | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Table of user defined type

Hi! I have a question about creating a user defined type: I’d like to create a table of employee objects which include objects of the type employee_t. I used this structure before in Oracle 9i and would like to know how it can be done with MS SQL Server 2000 or 2005, preferably with Enteprise Manager/Management Studio. Below is an example. CREATE TYPE employee_t AS OBJECT (
name VARCHAR(10)
jobDesc VARCHAR(15)

) CREATE TABLE Employee of employee_t Regards, Timo
I dont know if SQL Server 2005 supports that type of syntax. But in general you can write Select * into Employee from Employee_t or script Employee table and change the table name and run that
Otherwise you may need to refer CTE in sql server 2005 Madhivanan Failing to plan is Planning to fail
Microsoft SQL Server has not began supporting that kind of syntax yet. The closest SQL Server comes to dealing with "object types" is through the new XML data type and CLR user-defined types. Even these do not come close to what you really want. Nathan H. Omukwenyi
MVP [SQL Server]

timoomit – You’d need to use a related table, rather than nesting a table inside a column.

]]>