How to simply generate the CREATE SQL script for a table and data? [duplicate]

From the SQL Server Management Studio you can right click on your database and select:

Tasks -> Generate Scripts – Next -> Select objects that you need from list -> click on the advanced
Then simply proceed through the wizard. Make sure to set ‘Script Data’ to TRUE when prompted to choose the script options.

SQL Server 2008

enter image description here

SQL Server 2008 R2

enter image description here

Further reading:

Robert Burke: SQL Server 2005 – Scripting your Database

Taken from stack overflow:
How to get script of SQL Server data?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)