Elsasoft Forums
Elsasoft Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SqlSpec
 Tips and Tricks
 Maintaining comments through drop/create
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Dwatney
Starting Member

4 Posts

Posted - Mar 10 2008 :  08:53:28 AM  Show Profile  Reply with Quote
I was just giving someone a walk-thru of the SQLSpec output and she asked "What happens when we do a drop/create on an object?" Since the extended propertied are stored by object ID, not name, the properties get deleted when the object is dropped (I just confirmed that they are deleted, not orphaned).

Has anyone come up with an elegant solution to this? I can imaging pulling out the extended properties before the drop and re-adding them after the create.

Jesse
Forum Admin

732 Posts

Posted - Mar 10 2008 :  10:16:17 AM  Show Profile  Reply with Quote
what I do is script out the extended properties and keep them in source control along with the object's DDL.
Go to Top of Page

Dwatney
Starting Member

4 Posts

Posted - Mar 10 2008 :  12:49:34 PM  Show Profile  Reply with Quote
That was pretty much the conclusion I had come to and I've started working on that. Would you be willing to share the code you use and make a quick end to this process for me?
Go to Top of Page

Jesse
Forum Admin

732 Posts

Posted - Mar 10 2008 :  5:53:50 PM  Show Profile  Reply with Quote
I use a build of ScriptDB that I have modified to also script out extended properties.

scriptdb is an open source app I wrote a while ago for generating scripts in an automated way from the cmd line.

It's hosted on codeplex these days: http://www.codeplex.com/scriptdb

I suppose I should add the scripting of extended props as an option to the official build of ScriptDB on codeplex...

Go to Top of Page

Jesse
Forum Admin

732 Posts

Posted - Mar 10 2008 :  11:38:24 PM  Show Profile  Reply with Quote
quick update: I just created a new release of scriptdb on codeplex that supports scripting of extended properties. to use it, pass -p to specify you want the extended properties scripted. here's a sample command line:

scriptdb.exe -con:server=(local);database=pubs;trusted_connection=yes -outDir:scripts -v -p
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Elsasoft Forums © Elsasoft LLC Go To Top Of Page
Snitz Forums 2000