Sorry for the delay - I was on vacation.
The problem occurs when creating scripts from inside VS.
The UDDT is created as follows:
CREATE TYPE UserIdType FROM int NOT NULL
The table is created as follows:
CREATE TABLE Users (UserId UserIdType, Name varchar(50))
Then script out the "CREATE" for the table in VS (Right-click on the table in the Server Explorer and select "Generate Create Script to Project"). It will look as follows:
/****** Object: Table [dbo].[Users] Script Date: 08/28/2006 10:18:17 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Users]') AND type in (N'U'))
DROP TABLE [dbo].[Users]
GO
/****** Object: Table [dbo].[Users] Script Date: 08/28/2006 10:18:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Users]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Users](
[UserId] [int] NOT NULL,
[Name] [varchar](50) NULL
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
Note that the UserId's type is now "[int] NOT NULL" rather than "UserIdType", so the UDDT is lost.
|