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....
The Stored procedure in SQL 2000 will run - and then return the results to a refreshable pivot table in the Excel file.
Any ideas?
7 12828
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....
The Stored procedure in SQL 2000 will run - and then return the results to a refreshable pivot table in the Excel file.
Any ideas?
Write an Excel Macro for this.
Connect to SQL Server from Excel and call a procedure as required.
New to macros.
Any tips?
You can find lots of examples by little web searching.
Kindly POST what you tried so that we could help in case of any problem!!
Hi
Heres the Stored Procedure
Say in Excel ---- cell A1 = @Type and cell B1 = @LSS
Create Proc sp_Flickimp_test
@Type Varchar(3),
@LSS Varchar(3)
as
Select Provider_Code,
Commissioner_Code,
LSS_Flag,
Financial_Year,
Financial_Month,
Specialty_Code,
Description_Contract,
Activity_Type,
Case When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
Else Activity_Type End as Activity_Type_Grouped,
HRG_Code,
Specialised_Services_Code,
Local_AdmitUnit_Code,
Total_Spells, Tariff_Initial_Amount, Tariff_ShortStay_Spells,
Tariff_ShortStay_Adj, Tariff_SpecServ_Adj, Tariff_Final_Amount,
Tariff_LS_Spells, Tariff_LS_Days, Tariff_LS_Rate, Tariff_LS_Payment,
Tariff_Total_Payment, Local_Total_Payment, Local_AdmitUnit_Adj
From tbl_BaseLine_UHL_Spells_Trend_0708 a
Left Outer Join dbo.tbl_Refs_Specialty_UHL b
on a.Specialty_Code = b.Code
Left Outer Join dbo.tbl_Refs_IP_SpecServ_0708 c
on a.Specialised_Services_Code = c.SpecServ
Where (Financial_year = '2006/07' and Financial_Month between '7' and '12')
or (Financial_year = '2007/08' and Financial_Month between '1' and '6')
and Commissioner_Code = @Type
and LSS_Flag = @LSS
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use the tags in future.
MODERATOR
Hi
Heres the Stored Procedure
Say in Excel ---- cell A1 = @Type and cell B1 = @LSS
Create Proc sp_Flickimp_test
@Type Varchar(3),
@LSS Varchar(3)
as
Select Provider_Code,
Commissioner_Code,
LSS_Flag,
Financial_Year,
Financial_Month,
Specialty_Code,
Description_Contract,
Activity_Type,
Case When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
Else Activity_Type End as Activity_Type_Grouped,
HRG_Code,
Specialised_Services_Code,
Local_AdmitUnit_Code,
Total_Spells, Tariff_Initial_Amount, Tariff_ShortStay_Spells,
Tariff_ShortStay_Adj, Tariff_SpecServ_Adj, Tariff_Final_Amount,
Tariff_LS_Spells, Tariff_LS_Days, Tariff_LS_Rate, Tariff_LS_Payment,
Tariff_Total_Payment, Local_Total_Payment, Local_AdmitUnit_Adj
From tbl_BaseLine_UHL_Spells_Trend_0708 a
Left Outer Join dbo.tbl_Refs_Specialty_UHL b
on a.Specialty_Code = b.Code
Left Outer Join dbo.tbl_Refs_IP_SpecServ_0708 c
on a.Specialised_Services_Code = c.SpecServ
Where (Financial_year = '2006/07' and Financial_Month between '7' and '12')
or (Financial_year = '2007/08' and Financial_Month between '1' and '6')
and Commissioner_Code = @Type
and LSS_Flag = @LSS
Alright!! Did you try calling this from a Macro.
You need to connect to SQL server from Excel.
Hi
Sorry for not using the tags.
The Stored procedure was created in SQL Query Analyzer 2000.
I tried to use MS Query to pull the SP back with the variables, but no joy.
What steps must I take to allow the parameters from excel cells to be picked up by the stored procedure so that it returns the results back to excel?
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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 & _
"...
|
by: ABC |
last post by:
What methods can export excel file from stored procedure with parameters
which input from web form?
|
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...
|
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...
|
by: flickimp |
last post by:
Hi
I have a stored procedure on SQL Server 2000 called:
.Capacity_Planning.dbo.sp_flickimp_test
I have an Excel Sheet with the 2 paramters for the Stored procedure in cells A1 and B1.
How...
|
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),...
|
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;...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
| |