I am having a problem scripting out a database (all objects) to use for disaster recovery and development database purposes. I want to automate the process so it can be run in a scheduled job. I tried using the scptxfr utility and Ken Henderson's sp_generate_script (from The Guru's Guide to Stored Procedures, XML, and HTML - see http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=183331 for more info). I've also tried just right clicking the database and choosing generate SQL script.
Anyway, whenever I use these methods, it changes the names of some of the Primary Keys (that's all I've noticed so far). Example:
Original - PK_tblAccessLevelREF_AccessLevel
After script - PK__tblAccessLevelRE__0DAF0CB0
The names aren't specified like that in the script generated, but they end up that way in the resulting database objects after the script is run. Does anyone know of a way to generate a script that maintains the object names?