Hi,
I want create Store procedure with join
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Prabhu RajaRank #861 · 2.6K reputationPosted Dec 9, 2011, 9:14 PM EST
You can get Sample Code from :
http://searchsqlserver.techtarget.com/feature/Sample-T-SQL-stored-procedure-P_DisplayProductDetails
Vineet Kumar SainiRank #257 · 9.8K reputationPosted Dec 9, 2011, 10:29 PM EST
select t1.id, sp1.field1
from t1
join sp1(parameters) on t1.id = sp1.id;
It you wish, you can also use fields from the table as input values into stored procedure. It that case, make sure you use LEFT JOIN to force table fields to be evaluated first (so they are available to stored procedure):
select t1.id, sp1.field1
from t1
left join sp1(t1.id) on 1=1;
Thanks.....
Anuja PawarRank #1,404 · 1.2K reputationPosted Dec 19, 2011, 3:33 AM EST
Types of JOIN you can use
- JOIN: Return rows when there is at least one match in both tables
- LEFT JOIN: Return all rows from the left table, even if there are no matches in the right table
- RIGHT JOIN: Return all rows from the right table, even if there are no matches in the left table
- FULL JOIN: Return rows when there is a match in one of the tables
For more detail about joins refer thishttp://www.gplivna.eu/papers/sql_join_types.htm
I hope after reading this you can create a stored procedure using join