I want to generate create table script of already created table in my live database.
I know we can generate scripts using right click on table and click on ‘script table as’ menu and script will be generated. Because my live db UI is running very slow.
I want to do same process using SQL query. is there any way??
If you are looking for a TSQL solution, it is quite verbose, as this example shows.
A shorter alternative would be using the SMO library (example)
(I originally answered this here, but SQL Server-only devs probably do not relate the question title to this problem)