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.
| Author |
Topic |
|
daugman
Starting Member
2 Posts |
Posted - 2001-11-28 : 09:47:37
|
| When trying to compile ANY function, including the ones found on this site (the user-defined function article) or in BO, I get the following errors :Server: Msg 170, Level 15, State 1, Line 1Line 1: Incorrect syntax near 'FUNCTION'.Server: Msg 137, Level 15, State 1, Line 7Must declare the variable '@Country'.Server: Msg 178, Level 15, State 1, Line 19A RETURN statement with a return value cannot be used in this context.Here is the function I'm trying (right from the article):CREATE FUNCTION whichContinent (@Country nvarchar(15))RETURNS varchar(30)ASBEGINdeclare @Return varchar(30)select @return = case @Countrywhen 'Argentina' then 'South America'when 'Belgium' then 'Europe'when 'Brazil' then 'South America'when 'Canada' then 'North America'when 'Denmark' then 'Europe'when 'Finland' then 'Europe'when 'France' then 'Europe'else 'Unknown'endreturn @returnendAny ideas? |
|
|
izaltsman
A custom title
1139 Posts |
Posted - 2001-11-28 : 09:53:57
|
| Just checking -- are you on SQL7 or SQL2k? User-defined functions were not available on SQL7. |
 |
|
|
|
|
|