Use of user defined data type in table variable

  • Running below TSQL code

    EXEC sp_addtype N'type_udt1', N'char (6)', N'null'

    EXEC sp_addtype N'type_udt2', N'smallint', N'null'

    DECLARE @myTbl TABLE ( myId type_udt1 NOT NULL,

    OriginId type_udt2 NOT NULL)

    I got the error message:

    Server: Msg 2715, Level 16, State 7, Line 9

    Column or parameter #1: Cannot find data type type_udt1.

    Neither in BOL, nor in MSDN I see a constraint to forbid the use of user defined data type in udf.

    Need I to use system data types?

    Do you have any suggestion?

  • You are right. Looks like Microsoft recently updated this information in msdn online.

    Check this out

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_de-dz_66w5.asp

    which now contains,

    A user-defined data type cannot be used as a column scalar data type.

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

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