Is there a way I can get a scripting of all tables, procs, and other objects from a database? I know there\'s an option to script the database but it only gave me some sort
We ended up using a combination of SSMS script generation to extract schema and data, and then use our own database tool which allows keyword parsing and token based replacement in scripts. It also ensures scripts are only applied once.
Why?
Example script (edited for brevity)
-- Sleep: 5
-- Sleep after creating database to allow file system to create db files
CREATE DATABASE [$Database$]
GO
EXEC sp_dbcmptlevel [$Database$], $CompatabilityLevel$
GO
USE [$Database$]
GO
IF '1'!='$IntegratedSecurity$'
BEGIN
CREATE LOGIN [$Login$] WITH PASSWORD=N'$Password$', DEFAULT_DATABASE=[$Database$]
CREATE USER [$User$] FOR LOGIN [$Login$]
EXEC sp_addrolemember N'db_owner', N'$User$'
END
GO