MS SQL Server
  Home arrow MS SQL Server arrow Page 5 - Source Code Management and Database Deploy...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MS SQL SERVER

Source Code Management and Database Deployment
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 15
    2005-06-16

    Table of Contents:
  • Source Code Management and Database Deployment
  • Administering the Visual SourceSafe Database
  • Managing Create Scripts in Visual Studio .NET
  • Visual SourceSafe Explorer
  • Labels and Versions
  • Database Deployment
  • Deployment of Individual Objects
  • Scripting Data in Visual Studio .NET
  • Deploying Create Scripts in Visual Studio .NET

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Source Code Management and Database Deployment - Labels and Versions


    (Page 5 of 9 )

    You have probably realized by now that the term “version” in Visual SourceSafe does not actually correspond to the concept of version (or release) that we generally think of when we consider software. A Visual SourceSafe “version” actually corresponds to a change in the source code. You should use labels in Visual SourceSafe to implement the equivalent of a release.

    You can apply the Label option from the main window of the Visual SourceSafe Explorer. You can select one or more files and/or one or more projects (folders). When you apply the Label option (File | Label), the Label dialog box appears and prompts you to specify the text of the label (your official release number, for example).

    The current versions of all selected files will be labeled. Later, you can use these labels to collect the code that belongs to a particular version. This feature can be very important for supporting or testing the product.

    Even more exciting is the opportunity to view the complete history of a project (right-click the project folder and select Show History from the pop-up menu) and determine many historical facts about the project, such as which changes were performed on it after a particular release.

    Adding Database Objects to Visual SourceSafe: Traditional Approach

    Unfortunately, if you do not have Visual Studio .NET, it is not easy enough to manage the code of individual database objects with only the tools built into SQL Server and Visual SourceSafe. The process involves two steps:

    1. Generate scripts from SQL Server.

    2. Check in files into Visual SourceSafe.

    Therefore, I’ve created a tool that loops through database objects and scripts them into separate files—TbDbScript. It’s written in VBScript and you can download it from www.TrigonBlue.com/sqlxml/sqlxml_download.htm. To run it, you must use Windows Script Host and cscript.exe. Execute from the command prompt:

    cscript TbDbScript.vbs .\ss2k sa password c:\dbscripter\ Asset

    The parameters are: server, login, password, destination of database files, and, optionally, the database name. Use the space character as a parameter delimiter. If you omit the last parameter, the program will script all nonsystem databases on the server.

    When scripting is finished, you will find database objects in the set of Create scripts in the folder named after the database (see Figure 11-6).

    The tool also creates deployment scripts. They contain Create scripts grouped by type. You will read more about them in the “Deployment Scripts: Traditional Approach” section, later in the chapter.

    It is true that the Generate SQL Scripts Wizard in Enterprise Manager will perform similar actions, but there are several significant differences:

    • TbDbScript follows naming conventions used in Visual Studio.
    • Generation does not require user intervention and therefore is less prone to errors. The resulting files are always the same.
    • The script generates individual database object Create scripts and deployment scripts at the same time.
    • You can also schedule usage of TbDbScript, which may be very useful when the development team is not using Visual SourceSafe religiously—as when the team is making changes live to the development database.
    • Every deployment script file begins with a Use database_name statement and they can even be deployed manually using Query Analyzer.

      Figure 11-6.  Database object scripts generated by TbDbScript

    Now that Create scripts and deployment scripts are created, all you need to do is check them into the Visual SourceSafe database. You can do this manually with Visual SourceSafe Explorer or automatically with a little VBScript tool—TbDir2Vss.vbs. You can download the tool from www.TrigonBlue.com/sqlxml/sqlxml_download.htm. To run it, you must use Windows Script Host and cscript.exe. You need to specify the location of the srcsafe.ini file, username, password, Visual SourceSafe project/folder, and local folder:

    cscript TbDir2Vss.vbs "C:\Program Files\Microsoft Visual Studio\Common\VSS\srcsafe.ini" admin password $/Asset/ c:\dbscripter\Asset

    The TbDir2Vss.vbs tool can also be scheduled along with TbDbScript.vbs to script databases and put them in Visual SourceSafe.

    More MS SQL Server Articles
    More By McGraw-Hill/Osborne


     

    Buy this book now. This article is excerpted from SQL Server 2000 Stored Procedure & XML Programming, second edition, written by Dejan Sunderic (McGraw-Hill/Osborne, 2004; ISBN: 0072228962). Check it out at your favorite bookstore today. Buy this book now.

    MS SQL SERVER ARTICLES

    - Windows Server 2008 as a Workstation OS
    - An Overview of Windows Server 2008 R2
    - LINQ to MySQL, Oracle and PostgreSQL Provide...
    - Completing the Introduction to Transact-SQL
    - A Brief Introduction to Transact-SQL
    - Lookups and Blocking Bad Data
    - Field Validation Rules for Blocking Bad Data
    - Using Masks to Block Bad Data
    - Blocking Bad Data
    - Using @@ROWCOUNT and TABLE Variables for Dat...
    - How to Use Variables, IF and CASE in Databas...
    - Creating Important Aspects of Notification S...
    - Working wth Variables in Database Interactio...
    - Delving Deeper into Notification Services
    - Notification Services





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT