If I have a table with data in a database in SQL Server, how can I generate a script that will create the table and add the data too?
If I right click on the table
Use SSMS scripting feature (Rightclick on database->Tasks->Generate Scripts)
or
use SSMS Tools Pack
Here what you have to do:
Here You can see step by step process of Generate script in SQL Server Management Studio :
Step 1: Right Click on Your Database --> Select Task-->Generate Script..
Step 2: Select Next in Script Wizard
Step 3: Select Script Entire Database
Step 4:Choose Your File Name
and Finish
Now you can use your script file.