How to generate SQL Server scripts with a command

xiaoxiao2021-03-06  69

- The following SQL scripts that generate the entire database are quite easy to use. - (SCPTXFR.EXE path is correct, in the installation directory) Declare @cmd varchar (1000) set @cmd = 'master.dbo.xp_cmdshell' '' 'C: / "Microsoft' 'SQL Server"' '/ MSSQL / UPGRADE / SCPTXFR.EXE' '/ S YourServerName / P YoursaPassword / I / D YourDBName / F' 'C: /yourDbname.sql' 'EXEC (@cmd)

Command line syntax: SCPTXFR / S / d {[/ i] | [/ p ]} {[/ f