April 21, 2011 at 9:06 pm
I am working on the database deployment scripts and below is the script I am wanting to create.
if not exists (select Description from dbo.AppealType where Description = 'ICC')
begin
insert dbo.test([Description], [GroupType], [Sortorder], [CreatedBy], [CreatedDate], [LastUpdatedBy],[LastUpdatedDate])
VALUES ('ICC', 2, 2, suser_sname(), getdate(), suser_sname(), getdate())
end
My problem is that there over 60 reference tables and over 20,000 rows to be inserted in the post deployment script.
I wanted to know if there is any tool or way to automate this.
Abhishek
April 21, 2011 at 10:07 pm
don't deploy a script ;give the end user a complete backup with all tables and default data already in place; it's faster, easier and not prone to script errors
it's also a best practice in my opinion as well
Lowell
April 21, 2011 at 10:21 pm
I wish I could do that but I was ordered by the management and the senior DBA to have a post deployment script in place.Any work arounds? or non recommended methods?
April 22, 2011 at 4:13 am
the SSMS has an option to script data as wll as the table definitions; i've used it before
but it's weird when i went to Tools>>Options ...SQL Server Object Explorer>>Scripting i couldn't find the script data selection.
Lowell
April 22, 2011 at 5:34 am
You might want to take a look at Red Gate SQL Data Compare. It's a great tool for moving data between two databases. You can automate it too so that you can move data as part of your deployment processes. I cover a lot of this in the Team-based Development book chapters on deploying databases.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 22, 2011 at 7:02 am
I will take a look at the data compare tool. I have heard that red gate is pretty good.
April 22, 2011 at 7:11 am
I work for Red Gate, and Data Compare makes this easy if you are moving lots of data.
However the other thing you can do is export the data with bcp and use a deployment script to insert the data into the next server.
April 22, 2011 at 5:16 pm
ok. Thanks for your advice. I will look into the Red Gate software
April 22, 2011 at 6:01 pm
A few other things you can do with Redgate tools: you can use SQL Source Control, and source control the data in those reference tables. SQL Compare will work with SQL Source Control to generate the export scripts also.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply