In Enterprise Manager, right click a DB, select "all actions", and "Generate Script". Result is the SQL code required to generate an SQL schema (optionally: complete to the point of including users, database options, etc.).
\r\n\r\nChecking references, I don't find any equivalent automatic generation of same schema programmatically, using any stored procedures. There are a number of sites with instructions on how to create scripts which will do the same query for you though. Examples: [link|http://www.databasejournal.com/features/mssql/print.php/1442201|here], [link|http://www.microsoft.com/technet/treeview/default.asp?url=/technet/itcommunity/chats/trans/sql/sql1101.asp|here], [link|http://dbforums.com/archives/t160828.html|here], [link|http://dbforums.com/archives/t160828.html|here], and [link|http://forums.databasejournal.com/showthread.php?threadid=31326|here].
\r\n\r\nUsing sqsh, I have't got the script to run yet (still learning MS SQL Server, so I am probably futzing something up). Anyone know if I'm overlookign an existing functionality withing MS SQL Server before I invest the coding time into this?
\r\n\r\nBTW - sqsh is pretty cool stuff. But it's [link|http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=194065|got an authentication bug] when using ~/.sqshrc to supply password.