views:

47

answers:

2

I have winforms application in my company to deploy applications in several environments (Development, PreProduction, Production).

Now, I want to include a new functionality:

I need to deploy SQL Server scripts in environments: development, preproduction and production.

My application will run directly in these environments. I do not want to install Visual Studio in such environments. People with responsibility for the execution of the application and deployment do not know Visual Studio.

We need, also required is a good detailed error handling, of the execution of the sql scripts.

Therefore, I need source code or libraries, API, etctera, that I can use as references in my project csproj. The ultimate goal is to deploy scripts sql server 2005

Please, any sample source code, APIs, tools, ideas , I ask for help gurus, MVPs, anyone...

UPDATE: the environments are machines with Windows 2003, IIS 6.0.

Should ‘Hi’, ‘thanks’ and taglines and salutations be removed from posts? http://meta.stackoverflow.com/questions/2950/should-hi-thanks-and-taglines-and-salutations-be-removed-from-posts

+1  A: 

I'm not sure what version of SQL Server you're using and also if you mean you want your application to create the database for you.

However, check out the SQL Publishing Wizard (depending on the versions of apps you're using). The output script can be run by using the command-line osql command included with SQL Server or better via SQL Management Studio.

Joel Mansford
What differences if the dababase was created or not??.
alhambraeidos
Are youe looking for a solution that will generate a SQL script and then you use pre-existing tools to run those scripts?Or are you going to utilise some kind of framework to roll the SQL Scripts in to your app. In which case you will need to handle errors etc.
Joel Mansford
I use better pre-existing tools like osql o sqlcmd. If any sample code, will be great
alhambraeidos
+1  A: 

Hey mate,
Try DBSourceTools. http://dbsourcetools.codeplex.com
Its open source, and specifically designed to script an entire database - tables, views, procs to disk, and then re-create that database through a deployment target.
Once you have a deployment target, you can simply create a zip file for distribution.
Copy this zip file to your environment, un-zip it, and run the batch file.
Have fun.

blorkfish