473,785 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run Stored Procedure from Excel

37 New Member
Hi

I have a stored procedure on SQL Server 2000 called:

[Busobjects].Capacity_Plann ing.dbo.sp_flic kimp_test

I have an Excel Sheet with the 2 paramters for the Stored procedure in cells A1 and B1.

How do I execute a SQL Stored procedure from Excel pulling through the variables?

Someone told me to use:

----------------------------------------------------

dim cnn as adodb.connectio n
set cnn = new adodb.connectio n
cnn.open Connection
dim cmd as adodb.command
set cmd = new adodb.command
set cmd.activeconne ction = cnn
cmd.commandtype = "dbo.sp_Flickim p_test"
cmd.parameters. append cmd.createparam eter("@Type", adVarchar, adParamInput, 3, range("A1").val ue2)
cmd.parameters. append cmd.createparam eter("@LSS", adVarchar, adParamInput, 3, range("B1").val ue2)
dim rs as adodb.recordset
set rs = new adodb.recordset
rs.open cmd

-----------------------------------------

But I dont understand this?

I need step by step instructions on what to do.

Please help?!!?!?!?!?! ?
Nov 19 '07 #1
1 1908
flickimp
37 New Member
Anyone know a quick way to sort this?
Nov 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2007
by: james cox via SQLMonster.com | last post by:
I don't know if this is possible. However, what i am attempting to do is using C#'s window forms. I open up an excell sheet stored in my windows form. The excel sheet stores names of the stored procedures in that database. I want to know if it's possible to click on that stored procedure to open up a link to display the code of that stored procedure of course in a read only mode. any suggestions....
22
4291
by: M K | last post by:
Heres my SP: ( i am trying to add more than 1 field but get the same error no matter how many i try to add, i thought i would try to insert the primary key only and work up from there but the primary key insert didnt work either. I can run the SP manually in Visual Studio .NET and it works. When i try to do this it doesn't. Any help is greatly appreciated... newbie here as well so please be gentle :) ALTER PROCEDURE dbo.AddJob
0
2330
by: franjorge | last post by:
Hi, I have created two stored procedures via VB using this code: sql = "CREATE PROC " & nombre_proc & " AS SELECT *" & _ " From MBM_PUNTOS_SCE_SIN_COINCIDIR_SIEGE_FALTA_PM_NE_" & mes & _ " WHERE (((IDU) Like 'czz*' Or (IDU) Like 'cam*' Or (IDU) _ Like 'szz*' Or (IDU) Like 'J*' Or (IDU) Like 'G*' Or (IDU) _ Like 'U*'))" & " ORDER BY IDU;"
3
2604
by: ABC | last post by:
What methods can export excel file from stored procedure with parameters which input from web form?
0
1157
by: Paul | last post by:
Hi I have a simple stored procedure shown below and am trying to use it in a ..net window application to fill a dataset. IT works out of query analyzer, returns data from an excel file. Anyhow in the windows form the designer can not generate the schema so I can not configure a data adapter. I could use the Execute Nonquery but I need to return data so not quite sure if that would be correct. ALTER PROCEDURE emp_excel$inputfile...
3
7637
dbushcmohle
by: dbushcmohle | last post by:
Hello, I am having problems exporting a stored procedure's results to an Excel file... I've done this many times successfully, but never had to introduce a variable. Now that I've introduced the variable, I'm having problems. It is presenting the error listed below on the last line in my code section below. ERROR: Method ‘Open’ of object ‘Workbooks’ failed Dim xlApp As New Excel.Application Dim wbk As Excel.Workbook
7
12842
by: flickimp | last post by:
Hi I want to create a Stored Procedure in SQL with three variables that are declared in an Excel file. Thus, when the user enters the three variables into Cells A1, B1, C1 Then hits a button....
1
3983
by: seyyadri | last post by:
Hi, I want the data in excel, pulled from SQL server stored procedure. The SQL SP has the parameters. when we open/refresh the excel it should prompt the user to enter the parameters (dynamically), and depending on the parameters the relavent data should be populated in excel. Appreciate your help
4
3246
code green
by: code green | last post by:
Within a stored procedure I am creating a table from an Excel spreadsheet /*Create tmp table from XLS*/ SELECT * INTO tmp_cons FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0; Database=\\\path\to\Excel\spreadsheet.xls', 'SELECT * FROM ')Then joining this table to update another with new productsINSERT INTO consum_stk (part,qty) SELECT tmp_cons.Part,Stock FROM tmp_cons LEFT JOIN consum_stk ON tmp_cons.Part = consum_stk.part WHERE...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10148
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.