473,505 Members | 13,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing SQL Server 2005 objects and queries in Perforce

We are trying to use source control to store our database objects and
queries in Perforce. The general idea is to produce scripts which
create all objects in the DB and then store the SQL in source control.
Has anyone done this before and can suggest some advice? Alternatively
if anyone has other methods for using source control on a database,
could you please let me know?

Also, is there any automated way of extracting individual scripts for
object creation from the database?

Jan 29 '07 #1
2 3171
(d.******@gmail.com) writes:
We are trying to use source control to store our database objects and
queries in Perforce. The general idea is to produce scripts which
create all objects in the DB and then store the SQL in source control.
That's a very good idea!
Has anyone done this before and can suggest some advice? Alternatively
if anyone has other methods for using source control on a database,
could you please let me know?
We have used Source Control for our SQL code for more than 10 years,
although we are using SourceSafe and not Perforce. Over the years, we
have developed some tools around this, which by the time have become
quite versatile. But as a start, BAT files and OSQL or SQLCMD can take
you a long way. Just don't forget the -I option to enable quoted
identifiers!
Also, is there any automated way of extracting individual scripts for
object creation from the database?
This can be done with DMO on SQL 2000 and SMO on SQL 2005. But once you
have you code under source control, you should not script from the
database. The database is the place where you deploy your binaries.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jan 29 '07 #2
As Erland says, it's a very good idea to store your SQL object under
source control. We have written tools to make the process of keeping
your changes under source control and propagating them to your test
and production environments simple and straightforward. Please see
www.dbghost.com for more details.

Some great advantages of this way of doing things are:

1. A 100% audit trail of who changed what, when and why (source
control history)
2. Scales to hundreds or even thousands of developers
3. Saves developer time writing upgrade or delta scripts - the tool
does it for you
4. SQL changes can be properly synchronized with the other code
changes via changelists (atomic checkin)
5. Branches are easily compared for differences when you are comparing
the object CREATE statements rather than hand coded ALTER scripts.

I hope you like our approach :)

Regards,

Malcolm

On Jan 29, 11:48 am, d.gra...@gmail.com wrote:
We are trying to use source control to store our database objects and
queries in Perforce. The general idea is to produce scripts which
create all objects in the DB and then store the SQL in source control.
Has anyone done this before and can suggest some advice? Alternatively
if anyone has other methods for using source control on a database,
could you please let me know?

Also, is there any automated way of extracting individual scripts for
object creation from the database?
Jan 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6749
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
14
2582
by: mjkahn | last post by:
I've read (and read!) that you shouldn't store objects in Session variables. I've read these reasons: - The object takes up memory that may not be freed until the session times out. Better to...
6
1718
by: Kieran Benton | last post by:
Hi, I have quite a lot of metadata in a WinForms app that I'm currently storing within a hashtable, which is fine as long as I know the unique ID of the track (Im storing info on media files). Up...
10
3054
by: Diego F. | last post by:
Hello. I need to store custom objects in a SQL Server 2000 table. Which is the easiest way to do it? Do I need to write methods to store each attribute separately from C# app to the table and the...
1
1303
by: Martin Widmer | last post by:
Hi guys I am wondering what is a proper way to persistently store objects into SQL-Server. I see four possible ways: 1.) Serialize to XML and then store the XML in the SQL server 2.) Write a...
3
8404
by: tlyczko | last post by:
Can anyone refer me to good 'recipes' or sources of information on this topic?? I have Visual Studio Tools for Office, which installs SS 2005 Express locally to my XP box, and I want to develop...
3
2029
by: RSH | last post by:
Hi, I have a situation where I have created an object that contains fields,properties and functions. After creating the object I attempted to assign it to a session variable so i could retrieve...
4
7236
by: Zeljko Bilandzija | last post by:
Hy, could someone help me in this: In design mode, i want to put pictures in database. I made column named pics, and its type as image. How can I put pictures or some address of these pictures...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.