Hi All,
I need to copy table structures from one database to another. The copies will contain additional fields. Only table names, column names and column data types must be copied (no indexes, fk, pk, etc...).
I need to build the 'create table ...' statement and then execute it on another db.
My issue is building correct datatypes for each column, in more detail I am not sure when to specify the size of fields such as varchar(100), decimal(8,2) and when not to such as int, text, ntext, etc...
Another issue is custom user data types...
I've looked at INFORMATION_SCHEMA.COLUMNS view, but I can't find a best way of retrieving this data.
Any hints/tips?
I need to copy table structures from one database to another. The copies will contain additional fields. Only table names, column names and column data types must be copied (no indexes, fk, pk, etc...).
I need to build the 'create table ...' statement and then execute it on another db.
My issue is building correct datatypes for each column, in more detail I am not sure when to specify the size of fields such as varchar(100), decimal(8,2) and when not to such as int, text, ntext, etc...
Another issue is custom user data types...
I've looked at INFORMATION_SCHEMA.COLUMNS view, but I can't find a best way of retrieving this data.
Any hints/tips?