473,804 Members | 3,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Pass Parameters from SQL Server Stored Procedure to Excel

4 New Member
Hi,
I am new to Excel programming, can you please explain how can I pass the parameters of SQL SP to excel.
If I am not having any parameters I am using EXEC <SP Name> using new database query in Excel - it works.
Now I am having 2 parameters, how can I do that?
I am trying to use: EXEC <SP name> @param1, @param2, but it is giving error.
appreciate your help
Sep 9 '08 #1
5 15040
ck9663
2,878 Recognized Expert Specialist
A little confusing.

Where are you running the SP? Your question is about passing parameters from SQL Server to Excel, yet you called your SP from excel.

If you are running it from excel and wants to execute an SP, you can build the EXEC as string with all the parameters that you need. Don't forget the quotes.

-- CK
Sep 9 '08 #2
seyyadri
4 New Member
A little confusing.

Where are you running the SP? Your question is about passing parameters from SQL Server to Excel, yet you called your SP from excel.

If you are running it from excel and wants to execute an SP, you can build the EXEC as string with all the parameters that you need. Don't forget the quotes.

-- CK
Sorry for confusing.

I want the data in excel, pulled from SQL server stored procedure. The SQL SP has the parameters.
when I 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. thank you
Sep 9 '08 #3
ck9663
2,878 Recognized Expert Specialist
That's more of an EXCEL/VBA question than a sql server question. I would assume you will need to create a form or use excel's INPUTBOX function. Then from there you can dynamically build your SQL string.

Here's how you call stored procedure in SQL Server.

-- CK
Sep 9 '08 #4
seyyadri
4 New Member
That's more of an EXCEL/VBA question than a sql server question. I would assume you will need to create a form or use excel's INPUTBOX function. Then from there you can dynamically build your SQL string.

Here's how you call stored procedure in SQL Server.

-- CK
Thank you very much, I wil try and let you know
Sep 10 '08 #5
sgleeson
2 New Member
There is a method using a DSN connection the sytax is {call [procname](?,?)} add ?'s for extra parms. You can reference cells in the Excel sheet. To get to this, Import External Data, New Database Query, then click through any table from the DB the the Proc lives, then view query and click on the SQL button in ms Query, then simply enter the above in place of what ever SQL is there.
Nov 11 '08 #6

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

Similar topics

4
8792
by: mingzhen | last post by:
Hi, I have a problem here when I code stored procedure to manipulate data in database. My idea is that if I can save all data I get in some arrays I should be able to manipulate the arrays directly. But I do not know how to declare arrays in SQL server stored procedure and do not know other ways to do the same thing. Please help me out. Thanks in advance. -mingzhen
3
2485
by: Niyazi | last post by:
Hi, Me again. I want to create a SQL Server StoreProcedure and I want to access it with ADO.NET. I am using VB.NET. Creating StoreProcedure it was easy but my question is this. I have table with 4 Column and 6 rows. In the Column 3 for all rows I have to insert data. The data considt of the decimal value of Croiss Exchange and 6 my variable as:
6
2807
by: fumanchu | last post by:
I've got to let end users (really just one person) load billing batch files into a third party app table. They need to specify the billing cycle name, the batch name, and the input file name and then I can use these values to execute a SQL Server stored procedure to load them into the batch table from the input file (the stored procedure uses Dynamic SQL to Bulk Insert the file to a temp table then processes it into the final table.) My...
2
1845
by: honcho | last post by:
Hello, Does anyone have an example of an SQL Server stored procedure that updates a record, where one of its field is of type "text"? My procedure is /* ** Update the client note and production cycle in a Sites record. Set the ** When_submitted field to the current date/time. */ CREATE PROCEDURE spSiteNotePCycle
4
50418
by: Mr Not So Know It All | last post by:
im new to SQL Server and ASP.Net. Here's my problem. I have this SQL Server stored procedure with an input parameter and output parameter CREATE PROCEDURE . @in_rc varchar(8) @out_eList varchar(7) output AS select @out_eList = ecuid from _organization where rccode = @in_rc GO
2
1372
by: SwatSoftwareDev | last post by:
Hi All, I want to use XML technologies with SQL Server 2000 for sending master details data from Application to SQL Server. I'm using xmldocument class for writing data in the form of attribute centric elements. First I write data into xmldocument (using appendchild, setattributes methods), and then I use outerxml property to get the xml in a string variable to pass it to stored procedure as input parameter, where I use openxml to insert...
3
8220
by: Joseph Lu | last post by:
Hi, all I have a stored procedure created in SQL Server like the following lines. // stored proceudre code starts here CREATE PROCEDURE sp_insertdata @strdata varchar(250) , @rsult BIT OUTPUT , @erridx CHAR(7) OUTPUT
3
22386
by: nitinp | last post by:
I want to bind GridView with sqlDataSource like following sqlDataSource1.SelectCommand = "GET_TRACKING_INFO"; sqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; sqlDataSource1.SelectParameters.Add("Group_code",TypeCode.String, "1"); sqlDataSource1.SelectParameters.Direction =ParameterDirection.Input; GridView1.DataSource = sqlDataSource1; GridView1.DataBind();
0
1321
by: arunavlp | last post by:
hi, I am new to .net , i am using VB.Net (Web form). I dont know how to pass parameters to stored function. Regards, Arun.S
1
3986
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
0
9710
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
9589
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
10593
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
10340
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
7626
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
6858
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
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.