Register
Sunday, February 05, 2012
 
 DBAs And ProgrammersBlog
  
News! Minimize
   
 
 Print   
 
Misc Blog Stuff Minimize
   
 
 Print   
 
The Reluctant DBA Minimize
 
 
 
 Print   
 
Reluctant DBA Minimize
   
 
  
 
Reluctant DBA Minimize
   
 
  
 
The Reluctant DBA Minimize
 
May21

Written by:CarpDeus
5/21/2008 8:19 AM 

SQL Server 2005 does interface with Visual Source Safe. Which is, I suppose, a good thing.

But I hate VSS. Never truly liked it and, when I was introduced to SVN a few years back, did my best to give up VSS entirely. I've got an SVN server where I put all my important stuff and use Tortoise SVN as my interface. Quick, simple, mergeable... In short, many things that VSS isn't.

And I recently installed SP2 for SQL 2005 which FINALLY allows for scripting of database objects to seperate files again. So the first thing I did was dump databases out to directories as individual files and SVN them. Which was good. But there's no good way to say to the Script Wizard, "By the way, old chap, I'd like to just create those scripts for objects changed/created since this date." So I think I may write something, unless someone can point me to code that already does that. I'll use the DMO to create the script objects, that's for sure, but, until that time, I needed a way to determine what files I need to generate. So I came up wtih this handy piece of code:

SELECT schema_name(schema_id) + '.' + name Name, case type
    When'C' Then 'Check Constraint'
    When'D' Then 'Default or Default Constraint'
    When'F' Then 'Foreign Key Constraint'
    When 'L' Then 'Log'
    When 'FN' Then 'Scalar Function'
    When 'IF' Then 'Inlined Table Function'
    When 'P' Then 'Stored Procedure'
    When 'PK' Then 'Primary Key Constraint'
    When 'RF' Then 'Replication Filter Stored Procedure'
    When 'S' Then 'System Table'
    When 'TF' Then 'Table Function'
    When 'TR' Then 'Trigger'
    When 'U' Then 'User Table'
    When 'UQ' Then 'Unique Constraint'
    When 'V' Then 'View'
    Else 'Extended Stored Procedure'
    End type, modify_date
    FROM sys.objects
    WHERE modify_date > '5/15/2008 9:21'
order by 2, 1

The downside to this is that it lists all of the tables where anything has changed, not just schema changes. But it's a good start.

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment  Cancel 
 
 
  
 
Privacy Statement | Terms Of Use Copyright 2001-2008 by ReluctantDBA.com