Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Create Procedures

Author  Topic 

Parlo1
Starting Member

3 Posts

Posted - 2015-05-04 : 13:55:21
Bellow is my Question

Create a stored procedure that accepts a user Id and returns the user’s full name, occupation, the count to all orders they placed, the number of DVDs they own, and the number of vehicles they own

Thanks an advance guys hopefully when this question is answered others can learn from it! you guys rock!!



LOUISDOR

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-05-04 : 14:25:02
If you're looking for someone to create the proc from scratch, you're looking in the wrong plac.

HOwever, if you're just looking for hints or troubleshooting, please post your work so far along with CREATE TABLE statements for the tables involved, some sample data in the form of INSERT INTO statements and an example of what the proc should produce with that sample data.

Gerald Britton, MCSA
Toronto PASS Chapter
Go to Top of Page

Parlo1
Starting Member

3 Posts

Posted - 2015-05-04 : 15:11:07
Okay here's what I got working however I do not know how to incorporate the rest into the Procedure I don't know if I should create a view within my procedure or use a case statement to get the info
delimiter $$

DROP PROCEDURE IF EXISTS getFullInfo $$

CREATE PROCEDURE getFullInfo(in uId varchar(50), out fullName varchar(500))

begin
select concat(firstname''lastname) into fullname
from users
where userId = uId;
END $$


LOUISDOR
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-05-04 : 16:14:32
That looks like MySQL code. This is a SQL Server forum. Perhaps try:

forums.mysql.com

Gerald Britton, MCSA
Toronto PASS Chapter
Go to Top of Page

Parlo1
Starting Member

3 Posts

Posted - 2015-05-04 : 17:35:41
it is definitely sql but I will check that website out

LOUISDOR
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-05-04 : 18:42:13
quote:
Originally posted by Parlo1

it is definitely sql but I will check that website out

LOUISDOR



Sql is a generic term. SQLTeam.com is for Microsoft SQL Server. MySql is a different product. Both use a form of sql. It's important you get help for the product that you are using, since it'll be wrong if we provide the answer in Microsoft SQL Server.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -