469,090 Members | 1,100 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,090 developers. It's quick & easy.

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 1408

"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 this site, you agree to our Privacy Policy and Terms of Use.