MS SQL Server
  Home arrow MS SQL Server arrow Page 3 - 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 - Managing Create Scripts in Visual Studio .NET


    (Page 3 of 9 )

    When Create scripts are locked, you can open them for viewing in the editor, but Visual Studio .NET will prevent you from changing them until you check them out.

    To view a Create script, right-click the script you want to review and select Open. Visual Studio .NET opens a copy of the Create script but marks it “read-only.”

    The following list demonstrates how to change a stored procedure:

    1. Close the window with the read-only version of the Create script.

    2. Right-click the script for a stored procedure and select Check Out from the pop-up menu. The program prompts you for confirmation and comment:


    3. Make some trivial change to the stored procedure.

    4. Save the changes (File | Save) in the change file.

    5. Right-click the file and choose Check In from the menu. The program prompts you for confirmation and comment again.

      TIp
      Take the time to describe what changes you made in your comment. This will be incredibly helpful if some detective work is required later.
    6. Click Check In. Visual Studio .NET saves the changes in Visual SourceSafe and locks the Create script.
    7. At this point, the stored procedure does not yet exist in SQL Server. You must right-click the file and select Run to add it to the default database. Visual Studio .NET opens the Database Output pane to show the results (and possibly errors) of the execution (see Figure 11-3).


      Figure 11-3.  Database Output pane of the Create script
      executed against the server


      NOTE


      Unfortunately, this solution does not prevent another developer from using some other tool to change a database object directly in the database. You can even open Server Explorer in Visual Studio .NET to change them without source code control. Visual SourceSafe only works through consensus. Loose cannons can still wreak havoc on your development ship.

      To promote the change to another server, you can choose the Run On option in the context menu of the change script.

      TIP
      When I first started to use Visual SourceSafe, the directions implied by the terms “Check Out” and “Check In” sounded inverted to me. Just think of Visual SourceSafe as an actual safe from which you are taking your code and into which you subsequently return your code after you are done with it.

    8. Now, go back and check out the same stored procedure again.

    9. Open it and reverse your previous changes.

    10. Save the stored procedure.

    11. Run the Change script against the server to test it (right-click the Change script and select Run).

    Assume that you are not satisfied with these changes and that you want to abandon them. (Assume that you have tested them and the result is not what you expected.) To do so:

    1. Select Undo Check Out from the context menu. The Visual SourceSafe Server locks the file again and uses the previous copy from Visual SourceSafe to reverse the changes in the local file.

    2. To reverse changes to the database, you must Run the change script again.

    NOTE


    Undo Checkout does not actually change any code already deployed, but merely reverses the check out process.

    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