Store_schema Sql Script Download


I have an app which will be deployed on production PCs with SQL Server. I want to be able to store and retrieve a version of the schema in my database. I'm interested in best practices to be able to accomplish this, with the following main goals: • Able to store and easily retrieve a version number of the database. • Hidden or more difficult to find and manipulate by clients. • Able to be edited/changed when we create a new version. • Backing up the DB or detacting the DB keeps the version # for forensics. I wish there were a way to store a 'version' in the metadata or not a normal table, which could be accessed/set through a system stored procedure.
Any ideas or best practices? EDIT: One option I found which may be promising is to use SQL Server Extended Properties, to put a key value assigned to the DB with 'Schema_Version' and the version number. It isn't encrypted (but the value could be), and isn't hidden, but at least is removed from the actual DB structure which some of our users and field personnel browse (to my frustration!:) ).
Nov 5, 2007 - Learn to access Oracle databases through SQL statements and construct PL/SQL programs with guidance from Oracle expert, Jason Price. Published by Oracle Press, Oracle Database 11g SQL explains how to retrieve and modify database information, use SQL Plus and SQL Developer, work with.
@pearcewg if you want forensics, then you're stepping into the field of security and then you're missing the point with your requirements. You should not try to protect the database from people who own it - that is called 'overprotective design'. If you think really deep, you'll find that there is absolutely no way for you to know whether or not a guy with SA password was messing with the database. That's the whole point. Making the solution 'more difficult to find and manipulate' is just making you feel protected when you are not.
– May 14 '13 at 12:30. I'm the product manager for SQL Source Control and SQL Compare at Red Gate. We had to solve this very same problem as our tool needs to know which version the databases were at in order to select the appropriate migration scripts to build the full deployment script. We considered a version table, which is the most commonly devised home-grown solution. However, from our research we learnt that users wanted to keep the set of database objects 'unpolluted' so we opted for the database level extended property. We append this to the scripts as follows: IF EXISTS (SELECT 1 FROM fn_listextendedproperty(N'SQLSourceControl Database Revision', NULL, NULL, NULL, NULL, NULL, NULL)) EXEC sp_dropextendedproperty N'SQLSourceControl Database Revision', NULL, NULL, NULL, NULL, NULL, NULL EXEC sp_addextendedproperty N'SQLSourceControl Database Revision', @RG_SC_VERSION, NULL, NULL, NULL, NULL, NULL, NULL When the database is loaded into SQL Compare, it performs a check to ensure that the version that it claims to be corresponds to the version as stored in source control. The Essential Fred Hammond Zip La.