views:

72

answers:

2

Hi!

I need to execute an SSIS Package on SQL Server 2005 but programing them using the javasript code for a page web.

Anybody can help me please??

Thank you!

+1  A: 

JavaScript executing in a web page is executing in a client's browser. It can't directly call any code on the server.

You will need to create a web service, and have the page ask the service to execute the SSIS package. How to do that is beyond the scope of a single question. You'll want to learn how to use AJAX to call a web service, and how to execute an SSIS package from code (a web service, in this case).


More importantly, why do you have to do this with JavaScript? Why not do it in the codebehind, as part of a button click handler (as one example)?

John Saunders
http://ajaxian.com/archives/server-side-javascript-databases-access
Chris Klepeis
OLGA is talking about ASP.NET here, so no, this does not apply.
John Saunders
Hrmm I know theres server side javascript (SSJS) ... never played around with it though (and dont plan on it lol)... would it be possible with that? Granted I would never do this.
Chris Klepeis
A: 

JavaScript is a client-side language (and should stay that way!). You cannot run statements against a database from JavaScript. You need a server-side language for this (ASP.NET, PHP, or the like), or a web service for JavaScript to ping to kick it off.

Once you determine that, though, you can use sp_start_job to kick off a SQL Server Agent job that in turn kicks off the SSIS package for you. Or, you can use an exec command (depending on the language you use), and you can use the dtexec utility to directly start the package.

Eric
Of course I have a web service page where I'm working in ASP.NET and I prefer to use javascript language for a functions and the others routine like this, but I don't have any idea how to do it!Nom you understand me?
I need any example of code ASP- javascript