Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'ve executed the function already which is why now I\'m getting the red line b

ID: 3732508 • Letter: I

Question

I've executed the function already which is why now I'm getting the red line because it already does exist. But I cannot figure out how to test it by passing things like 'mod_cook', 'business', etc. Through it.

I don't really know how to test to make sure this works. I tried a Select function but I don't think I have the syntax right to get it to work.

Create Function fn SelectFullTitleTypeS S m513 @Type Char(12)) --list of arguments, has a single argument coming in at typechar Returns NvarChar (50) -will return as AS BEGIN RETURN SELECT CASE @Type WHEN business'THEN 'Business WHEN 'mod_cook THEN 'Modern Cooking WHEN 'popular_comp' THEN 'Popular Computing' WHEN psychology' THEN Psychology WHEN 'trad_cook' THEN 'Traditional Cooking WHEN UNDECIDED' THEN 'Undecided END )this end is the end for Case END This ends the begin

Explanation / Answer

** Try this out ::

Create Function fn_SelectFullTitleTypeS_S_m513

( @Type Char(12) ) --list of arguments, has a single argument coming in at typechar

     Returns NvarChar(50) --will return as

                    AS

                      BEGIN

                                                RETURN ( SELECT CASE @Type

                                                                                                WHEN 'business' THEN 'Business'

                                                                                                WHEN 'mod_cook' THEN 'Modern Cooking'

                                                                                                WHEN 'popular_comp' THEN 'Popular Computing'

                                                                                                WHEN 'psychology' THEN 'Psychology'

                                                                                                WHEN 'trad_cook' THEN 'Traditional Cooking'

                                                                                                WHEN 'UNDECIDED' THEN 'Undecided'

                                                                                END ) --this end is the end for case

                                END; --this ends the begin       

GO

Select dbo.fn_SelectFullTitleTypeS_S_m513('mod_cook')

** You can execute function using following line

Select dbo.fn_SelectFullTitleTypeS_S_m513('mod_cook')

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote