473,507 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using procedure results as table

16 New Member
Hi i recently wrote a seach engine type website using access. The problem is now i have to convert all my queries to stored procedures; some of my vbscripting code calls certain queries as tables.

1. Can i call a procedure the same way i call a querie in access for example.
Select x,y,b from queryletters order by y .

Say i have a procedure called sp_getNames which is for example written in the follwing way

CREATE PROCEDURE dbo.sp_StaffDetails
AS SELECT
tblStaff.Staff_Code,tblStaff.Staff_Name,tblStaff.S taff_Surname,tblStaff.Business_Unit,tblStaff.Line_ Manager
FROM dasuser.tblStaff
GO

And then call this procedure from another procedure in my asp code?
For example if i have a procededure

CREATE PROCEDURE dbo.getStaffSpecific
(@ID varchar(8)
AS
select * from sp_StaffDetails where staff_code = @id
GO??
Please help
Jul 20 '07 #1
1 1311
Vidhura
99 New Member
Hi i recently wrote a seach engine type website using access. The problem is now i have to convert all my queries to stored procedures; some of my vbscripting code calls certain queries as tables.

1. Can i call a procedure the same way i call a querie in access for example.
Select x,y,b from queryletters order by y .

Say i have a procedure called sp_getNames which is for example written in the follwing way

CREATE PROCEDURE dbo.sp_StaffDetails
AS SELECT
tblStaff.Staff_Code,tblStaff.Staff_Name,tblStaff.S taff_Surname,tblStaff.Business_Unit,tblStaff.Line_ Manager
FROM dasuser.tblStaff
GO

And then call this procedure from another procedure in my asp code?
For example if i have a procededure

CREATE PROCEDURE dbo.getStaffSpecific
(@ID varchar(8)
AS
select * from sp_StaffDetails where staff_code = @id
GO??
Please help
You have to use Exec dbo.sp_StaffDetails @ID

Refer the following

http://www.aspfree.com/c/a/ASP.NET-C...return-values/


You can use SQL function instead for first stored procedure

CREATE FUNCTION dbo.UDFStaffDetails
(@ID int)
-- Procedure B
RETURNS TABLE
AS
RETURN(SELECT
tblStaff.Staff_Code,tblStaff.Staff_Name,tblStaff.S taff_Surname,tblStaff.Business_Unit,tblStaff.Line_ Manager
FROM dasuser.tblStaff
)
GO

CREATE PROCEDURE dbo.getStaffSpecific
(@ID varchar(8)
AS
begin
select * from UDFStaffDetails (@ID)
end
Jul 21 '07 #2

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

Similar topics

0
1961
by: Golawala, Moiz M (GE Infrastructure) | last post by:
Hi All, I am having problem returning values from a Stored Procedure that creates a dynamic table (table variable) inserts values during a procedure and then I select from that dynamic table to...
2
4945
by: Jose Perez | last post by:
Dear All, I have 2 SP's, one (let's call it sp_A) which returns a list of files and another (let's call it sp_B) which recursively looks through a menu table to give me the location of the file....
4
7149
by: John | last post by:
Hi everyone, I have a stored procedure which I use to query a table. The first part of the stored procedure uses a cursor to update a temp table whilst the second part of the query actually...
5
4117
by: mas | last post by:
I have a Stored Procedure (SP) that creates the data required for a report that I show on a web page. The SP does all the work and just returns back a results set that I dump in an ASP.NET...
6
26511
by: Terentius Neo | last post by:
Is it possible to combine (in DB2 UDB 8.1) a stored procedure and a select statement? I mean something like this: Select c.number, call procedure( c.number ) as list from table c With best...
2
1708
by: Mike Hutton | last post by:
I have a rather odd problem. I have a SP which uses temp. tables along the way, and then returns a table of results: CREATE PROCEDURE dbo.usp_myproc( @pNameList VARCHAR(6000) ) AS
2
2364
by: Patrick Olurotimi Ige | last post by:
When i run the code below with stored proc :- I get only the first table results :-"templates" even if i fill the dataset with another table for example category,pages etc.. Any ideas? ...
2
5244
by: Brian Tkatch | last post by:
I've been asked to time about forty PROCEDUREs in the database, and keep a history of them for comaprison. So, i figured i'd quickly try it in the database itself, so anyone could execute it...
0
1149
by: mraikundalia | last post by:
I have multiple Playerid.. (1 to 37) how can i incorperate this into the stored procedure.. I could hard code all 37 but when an increase is players i would have to modify every single time. Below...
8
2789
by: rbg | last post by:
I did use query plans to find out more. ( Please see the thread BELOW) I have a question on this, if someone can help me with that it will be great. In my SQL query that selects data from table,...
0
7114
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...
0
7377
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...
1
7034
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...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
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,...
0
4702
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
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...

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.