arst06d
Programmer
- Nov 29, 2002
- 324
Hi
Can anyone please tell me what options I have to use to script a complete database into one text file?
I currently am scripting each database object into separate files, and would like a one-stop method for recreating the database - everything except the data.
I've tried the following
but all that gives me is a text file containing:
Thanks in advance
Can anyone please tell me what options I have to use to script a complete database into one text file?
I currently am scripting each database object into separate files, and would like a one-stop method for recreating the database - everything except the data.
I've tried the following
Code:
db.Script SQLDMOScript_Default + SQLDMOScript_DatabasePermissions, cstrScriptPath & db.Name & "\" & db.Name & ".sql", SQLDMOScript2_Default
but all that gives me is a text file containing:
Code:
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'Balance Sheet')
DROP DATABASE [Balance Sheet]
GO
CREATE DATABASE [Balance Sheet] ON (NAME = N'Balance Sheet _Data', FILENAME = N'E:\Program Files\Microsoft SQL Server\MSSQL\Data\BalanceSheet.mdf' , SIZE = 3321, MAXSIZE = 7000, FILEGROWTH = 20%) LOG ON (NAME = N'Balance Sheet _Log', FILENAME = N'E:\Program Files\Microsoft SQL Server\MSSQL\Data\BalanceSheet_log.ldf' , SIZE = 1, MAXSIZE = 1000, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
GO
exec sp_dboption N'Balance Sheet', N'autoclose', N'false'
GO
exec sp_dboption N'Balance Sheet', N'bulkcopy', N'false'
GO
exec sp_dboption N'Balance Sheet', N'trunc. log', N'true'
GO
exec sp_dboption N'Balance Sheet', N'torn page detection', N'false'
GO
exec sp_dboption N'Balance Sheet', N'read only', N'false'
GO
exec sp_dboption N'Balance Sheet', N'dbo use', N'false'
GO
exec sp_dboption N'Balance Sheet', N'single', N'false'
GO
exec sp_dboption N'Balance Sheet', N'autoshrink', N'true'
GO
exec sp_dboption N'Balance Sheet', N'ANSI null default', N'false'
GO
exec sp_dboption N'Balance Sheet', N'recursive triggers', N'false'
GO
exec sp_dboption N'Balance Sheet', N'ANSI nulls', N'false'
GO
exec sp_dboption N'Balance Sheet', N'concat null yields null', N'false'
GO
exec sp_dboption N'Balance Sheet', N'cursor close on commit', N'false'
GO
exec sp_dboption N'Balance Sheet', N'default to local cursor', N'false'
GO
exec sp_dboption N'Balance Sheet', N'quoted identifier', N'false'
GO
exec sp_dboption N'Balance Sheet', N'ANSI warnings', N'false'
GO
exec sp_dboption N'Balance Sheet', N'auto create statistics', N'true'
GO
exec sp_dboption N'Balance Sheet', N'auto update statistics', N'true'
GO
if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
exec sp_dboption N'Balance Sheet', N'db chaining', N'false'
GO
Thanks in advance