Problem with DDL generation with SQL Server User-Defined Data Types.
Hi,
I am working with SDDM 3.3.0.747 on Windows 7.
I'd like to generate DDL for SQL Server 2008 database which will look similar to this:
-----
CREATE DEFAULT dbo.DEF_NA
AS 'N/A'
GO
CREATE TYPE dbo.DM_CH10
FROM nvarchar(10) NOT NULL
GO
EXECUTE sp_bindefault DEF_NA, 'DM_CH10'
GO
CREATE TABLE Table1
(
Column1 DM_CH10
)
-----
I have created UDDT Distinct Types in Data Type Model, defined default in Physical model for SQL Server 2008 and the best DDL I could get so far is like this:
-----
CREATE DEFAULT dbo.DEF_NA
AS 'N/A'
GO
CREATE TYPE dbo.DM_CH10
FROM NVARCHAR (10)
NOT NULL
GO
EXEC sp_bindefault 'dbo.DEF_NA', 'dbo.DM_CH10'
GO
CREATE TABLE dbo.Table_1
(
Column1 NVARCHAR (10) NOT NULL COLLATE Czech_100_CI_AS ,
)
GO
EXEC sp_bindefault 'DEF_NA' , 'Table_1.Column1'
GO
-----
What bothers me most is:
1. I cannot make DDL generator to use UDDT types in 'CREATE TABLE' statement
2. Even if I run this, 'CREATE TABLE' will fail as 'NOT NULL' must be specified after 'COLLATE Czech_100_CI_AS'
3. 'EXEC sp_bindefault' will fail if I have (and I do have) Table_1 in more than one schema.
Any help would be appreciated.
MilGl