Hi,
I want create Store procedure with join
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anuja PawarPosted Dec 19, 2011, 8:33 AM
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
Vineet Kumar SainiPosted Dec 10, 2011, 3:29 AM
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.....
Prabhu RajaPosted Dec 10, 2011, 2:14 AM
You can get Sample Code from :
http://searchsqlserver.techtarget.com/feature/Sample-T-SQL-stored-procedure-P_DisplayProductDetails