|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 6:44 AM
Points: 1,185,
Visits: 2,099
|
|
Hi All
Is there anyway I can use the below script to generate CREATE DATABASE commands?
select DB_NAME(smf.database_id)DatabaseName,type_desc,smf.name,physical_name,size ,sd.collation_name from sys.master_files smf inner join sys.databases sd on db_name(smf.database_id) = sd.name where db_name(smf.database_id) not in ('master','model','tempdb','msdb') order by name
Thanks
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Yesterday @ 7:19 AM
Points: 1,562,
Visits: 1,716
|
|
What might be a better way to do it is using the Object Explorer Details window in Management Studio. If you click on the Databases folder in Object Explorer, then from the top menu bar select View\Object Explorer Details, then a new tab pops up in SSMS. You can highlight all the databases you want to script, then right click and select Script Database As... Create To... This will be much more detailed than trying to just use sys.databases and sys.master_files
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 6:44 AM
Points: 1,185,
Visits: 2,099
|
|
|
|
|