471,873 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

Creating UDT from another UDT

Hi,
I have a User Defined Datatype, which I want to use to define another
data-type. I tried the obvious:

EXEC sp_addtype
@typename = UDT_OBJECT_ID,
@phystype = 'NUMERIC (5)',
@nulltype = 'NULL'
GO

EXEC sp_addtype
@typename = UDT_TRACKING_NUM,
@phystype = UDT_OBJECT_ID,
@nulltype = 'NOT NULL'
GO

but that didn't work :

Msg 15036, Level 16, State 1, Server SKINNER, Procedure sp_addtype, Line 186
The data type UDT_OBJECT_ID does not exist.

Has anyone done this before,

Thanks,
Rowland.
Jul 20 '05 #1
2 1439

"Rowland" <ba*****@hotmail.com> wrote in message
news:cg**********@titan.btinternet.com...
Hi,
I have a User Defined Datatype, which I want to use to define another
data-type. I tried the obvious:

EXEC sp_addtype
@typename = UDT_OBJECT_ID,
@phystype = 'NUMERIC (5)',
@nulltype = 'NULL'
GO

EXEC sp_addtype
@typename = UDT_TRACKING_NUM,
@phystype = UDT_OBJECT_ID,
@nulltype = 'NOT NULL'
GO

but that didn't work :

Msg 15036, Level 16, State 1, Server SKINNER, Procedure sp_addtype, Line
186
The data type UDT_OBJECT_ID does not exist.

Has anyone done this before,

Thanks,
Rowland.


No - see the documentation for sp_addtype. You can only create a UDDT based
on a native MSSQL data type, not on another UDDT.

The best way to manage this is probably to script your UDDTs, so you can
create a new one by just changing the name in the script.

Simon
Jul 20 '05 #2

"Simon Hayes" <sq*@hayes.ch> wrote in message
news:41**********@news.bluewin.ch...

"Rowland" <ba*****@hotmail.com> wrote in message
news:cg**********@titan.btinternet.com...
Hi,
I have a User Defined Datatype, which I want to use to define another
data-type. I tried the obvious:

EXEC sp_addtype
@typename = UDT_OBJECT_ID,
@phystype = 'NUMERIC (5)',
@nulltype = 'NULL'
GO

EXEC sp_addtype
@typename = UDT_TRACKING_NUM,
@phystype = UDT_OBJECT_ID,
@nulltype = 'NOT NULL'
GO

but that didn't work :

Msg 15036, Level 16, State 1, Server SKINNER, Procedure sp_addtype, Line
186
The data type UDT_OBJECT_ID does not exist.

Has anyone done this before,

Thanks,
Rowland.
No - see the documentation for sp_addtype. You can only create a UDDT

based on a native MSSQL data type, not on another UDDT.

The best way to manage this is probably to script your UDDTs, so you can
create a new one by just changing the name in the script.

Simon


Thanks for the info - I think scripting the UDDTs should work well in my
case, so I'll give that a go.

Rowland.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.