I tried:
Select * Into <DestinationTableName> From <SourceTableName> Where 1 = 2
but the default value constraint is not created.
I have a smalldatetime column whose default value is getdate().
I tried:
Select * Into <DestinationTableName> From <SourceTableName> Where 1 = 2
but the default value constraint is not created.
I have a smalldatetime column whose default value is getdate().
Nothing wrong with quick and easy short-cuts.
it just takes a bit of work. ;-)
Create a user defined function using the code from the link, then you can exec the output...
snip...
select @tsql = dbo.udf_GenerateTableCreateScript(N'dbo.mytable')
exec @tsql