MS SQL Server Question - Script to run on DB to output Create script for tables

TechBoyJK

Lifer
Oct 17, 2002
16,699
60
91
Is there a command you can run on a DB in Microsoft SQL Server 2008 that will output 'create table' scripts for every table in the DB? I'd want it to include all create stuff too.. like indexes, keys, etc. I'd also like it to output users and their roles on the DB.
 

KLin

Lifer
Feb 29, 2000
30,950
1,076
126
1. Right Click the database in SQL management studio in the object explorer window
2. click tasks, then generate scripts
3. Wizard will walk you through allowing you script out whatever objects you want created
4. ...
5. PROFIT
 

ForumMaster

Diamond Member
Feb 24, 2005
7,792
1
0
continuing on KLin's reply, i don't use sql server. i'm an oracle guy, but two seconds of googling brought me to this page.

good luck.