tags:

views:

370

answers:

2

Are there any commands that make life easy with respect to this? I want to take the column schema of one datatable (.net datatable) and copy it to another new datatable.

A: 

I've seen something like:

SELECT * INTO [DestinationTable] FROM [SourceTable] WHERE (1=2);

Used in SqlServer.

I think this assumes that DestinationTable doesn't exist. It then creates the table and copies the schema from SourceTable the WHERE clause prevents any actual data from being copied.

I'm not really a database developer, so there's probably a much better way to do this.

rich
This may be correct, however I'm talking about datatables with respect to .Net. Sorry if I was not clear
Chris
A: 

I've found the answer. It is the .Clone method.

Chris