?
Solved

How to call a stored procedure from a function

Posted on 2009-04-06
3
Medium Priority
?
228 Views
Last Modified: 2013-11-24
Hi,

I'd like to know how / correct syntax I should be using to call a stored procedure in SQL Server from a script function in JavaScript.

The environment I'm working in is Sage CRM however the answer to this question does not appear to need to be specific to any particular software.

Thanks
0
Comment
Question by:TartanTaurus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Expert Comment

by:elimesika
ID: 24081441
0
 
LVL 1

Author Comment

by:TartanTaurus
ID: 24088073
Thanks for that,

I have my connection as follows, but when I try to call it, I get an error saying it cannot find stored proc by that name. Any suggestions?

Thanks


function UpdateRecord()
 
{
var connection = new ActiveXObject("ADODB.Connection");
connection.Open("Data Source=localhost\\TabletProject,1433;Provider=SQLOLEDB;User Id=sa;Password=xxxxx;Persist Security Info=True;Initial Catalogue=G41;");
 
var r = connection.Execute("exec customrefproc");
 
oppo_customref = r; 
}

Open in new window

0
 
LVL 19

Accepted Solution

by:
elimesika earned 2000 total points
ID: 24123234
HI

Try using fully qualified name
connection.Execute("exec <your database>.dbo.customrefproc");

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about achieving the basic levels of HRIS security in the workplace.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question