<p>I need to be able to retrieve a CREATE TABLE script to recreate a specific table in a SQL Server (2000) database, programmatically (I'm using C#). Obviously you can do this with Enterprise Manager but I would like to automate it. </p>

<p>I've been playing around with SQLDMO which offers a Backup command, but I'm not sure if this will give a SQL CREATE TABLE script and seems to require the creation of a SQL Service device, and I would prefer to avoid modifying the database.</p>

[{'answer_id': 49030, 'author': 'Blorgbeard', 'author_id': 369, 'author_profile': 'https://Stackoverflow.com/users/369', 'pm_score': 2, 'selected': False, 'text': '<p>Take a look at <a href="http://www.stackoverflow.com/questions/21547/in-mssql-how-do-i-generate-a-create-table-statement-for-a-given-table">my solution</a>. It\'s a sql script which uses the INFORMATION_SCHEMA tables to get the necessary information. It\'s basic, but might work for you.</p>\n'}, {'answer_id': 3021052, 'author': 'Phil Haselden', 'author_id': 1899, 'author_profile': 'https://Stackoverflow.com/users/1899', 'pm_score': 0, 'selected': False, 'text': '<p>You can use SMO to generate the scripts. For more info see: <a href="http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated" rel="nofollow noreferrer">http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated</a></p>\n'}]
['https://Stackoverflow.com/questions/49014', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']