ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister


Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters




Microsoft (MCSE, MCSD, MOUS, MCAD) > SQL server exams > Coco's question of the Week #6

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread



Author Coco's question of the Week #6
cocolocopolo
Senior Member




Registered: Apr 2001
Location: Los Angeles
Country: USA
State:
Certifications: A+, Network+, CCNA
Working on: MCDBA

Total Posts: 287
Coco's question of the Week #6

I practised to create a function as follows:

Create Function fnEmployeeByDepartment (@DepartmentID int)
Return Table
As
Return (Select * From Employee Where DepartmetnID = @DepartmentID)
Go

But I got following error:

=================
Server: Msg 156, Level 15, State 1, Procedure fnEmployeeByDepartment, Line 2
Incorrect syntax near the keyword 'Return'.
Server: Msg 178, Level 15, State 1, Procedure fnEmployeeByDepartment, Line 4
A RETURN statement with a return value cannot be used in this context.


Please h-e-l-p !!

__________________
cocolocopolo

Report this post to a moderator

Old Post 09-10-02 07:22 AM
cocolocopolo is offline Click Here to See the Profile for cocolocopolo Click here to Send cocolocopolo a Private Message Add cocolocopolo to your buddy list Find more posts by cocolocopolo Reply w/Quote Edit/Delete Message IP: Logged
2lazybutsmart
The Game Never Ends




Registered: Jun 2002
Location: Toronto
Country: Canada
State:
Certifications: MCSD, MCP
Working on: MCSD.net, MCDBA, MCT

Total Posts: 684

the first RETURN is "RETURNS" with a "S". don't forget that. the rest of ur function is two thumbs-up. make that slight change and ur off like a rocket.

so ur functio would look like this:
---------------
CREATE FUNCTION fnEmployeeByDepartment (@DepartmentID int)
RETURNS Table
AS
RETURN (Select * From Employee Where DepartmetnID = @DepartmentID)
Go
----------

cheers.

__________________
Crime is Common, Logic is Rare.
TechExams.net moderator

Report this post to a moderator

Old Post 09-10-02 01:23 PM
2lazybutsmart is offline Click Here to See the Profile for 2lazybutsmart Click here to Send 2lazybutsmart a Private Message Add 2lazybutsmart to your buddy list Find more posts by 2lazybutsmart Reply w/Quote Edit/Delete Message IP: Logged
cocolocopolo
Senior Member




Registered: Apr 2001
Location: Los Angeles
Country: USA
State:
Certifications: A+, Network+, CCNA
Working on: MCDBA

Total Posts: 287

Thanks 2lazybutsmart.

It seems I am too careless.

__________________
cocolocopolo

Report this post to a moderator

Old Post 09-11-02 07:38 AM
cocolocopolo is offline Click Here to See the Profile for cocolocopolo Click here to Send cocolocopolo a Private Message Add cocolocopolo to your buddy list Find more posts by cocolocopolo Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply


Forum Jump:
Rate This Thread:
Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is ON.
 

ExamNotes forum archive


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps