473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Using Stored procedures in a join

Hi, I have a stored procedure that requires several input parameters. I
would like to join the results of the stored procedure with another
table but I'm having a tough time getting the syntax correct. For
example:

To run the stored procedure:
exec usp_FetchPeople(@Gender = 'F', @City = 'Boston')

This returns a table:
PID | Age | Email

Now I want to join this with a table of notes but I can't get the syntax
corret. Something like this:

select N.Note from Notes as N
inner join (exec usp_FetchPeople(@Gender = 'F',
@City = 'Boston')) as P on P.PID = N.PID

but I get errors. What is the correct syntax? Thank you very much.

David


<img src="http://www.sen.us/mirror/SENLogo_62_31.jpg">
Meet people for friendship, contacts,
or romance using free instant messaging software! See a picture you
like? Click once for a private conversation with that person!
http://www.sen.us

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 14051
[posted and mailed, please reply in news]

David Berman (da**********@bose.com) writes:
Hi, I have a stored procedure that requires several input parameters. I
would like to join the results of the stored procedure with another
table but I'm having a tough time getting the syntax correct. For
example:

To run the stored procedure:
exec usp_FetchPeople(@Gender = 'F', @City = 'Boston')

This returns a table:
PID | Age | Email

Now I want to join this with a table of notes but I can't get the syntax
corret. Something like this:

select N.Note from Notes as N
inner join (exec usp_FetchPeople(@Gender = 'F',
@City = 'Boston')) as P on P.PID = N.PID

but I get errors. What is the correct syntax? Thank you very much.


There isn't any. :-)

For a discussion on how to approach the problem, take a look at an article
I have on my web site: http://www.algonet.se/~sommar/share_data.html.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: G.J. v.d. Kamp | last post by:
Hi all, I have a challenge (not a problem). Simplifing it as far as i could, i have this situation: Table Persons Id (PK) Name Table Scores
3
by: Eugene | last post by:
Hi, Is there any way to find all stored procedures that contain a given field Example: I want to find all stored procedures that work with the field ShipDate in tblOrder table Thanks, Eugene
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
5
by: Rob Wire | last post by:
For the code below, how could I add an item in the drop down lists for both company and location to be an "All" selection that would send to the stored proc. spRptAttachments a value of "%" so...
4
by: Bill Moran | last post by:
I'm having a little trouble understanding how to do something. I assume I'm just missing it in the documentation, so a pointer to relevent docs would be as welcome as a direct answer. I have a...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
12
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that...
1
by: Genken | last post by:
How would i convert or write a simple or complex access query to sql server stored procedures i will include my most complex query i hope somebody can help. Thankyou in advance. SELECT...
3
by: Aswanth | last post by:
Hi.., I'm having Two Stored Procedures in Two Different Databases.. Database1 - Employee Stored Procedure - Employee_Details Database2 - Company Stored Procedure - Company_Details
5
by: Bogdan | last post by:
Hi, I have a stored procedure that uses JOINs to return columns from multiple tables. I also have another stored proc that that takes a series of params and updates multiple tables. I used the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.