Author |
Topic |
lalbatros
Yak Posting Veteran
69 Posts |
Posted - 2008-02-01 : 01:25:54
|
I don't see why I get a syntax problem in this code: quote: ALTER FUNCTION dbo.limitExceeded(@var FLOAT, @limit FLOAT) RETURNS INT ASBEGIN DECLARE @ret int; IF @var > @limit SELECT @ret = 1 ELSE SELECT @ret = 0 RETURN @retEND
I am using access 2003 as front-end and I get this error message:quote: ADO error: Incorrect sysntax near the keyword 'ALTER'.'ALTER FUNCTION' must be the first statement in a query batch.Must declare the variable '@var'.Incorrect syntax near the keyword 'ELSE'.Line 6: Incorrect synstax near ')'.
Thanks for your patient help ... |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-01 : 02:18:30
|
T-SQL functions are not availabled in Access 2003. VBA functions are. E 12°55'05.25"N 56°04'39.16" |
 |
|
lalbatros
Yak Posting Veteran
69 Posts |
Posted - 2008-02-01 : 02:48:41
|
Peso,I am using an adp project in Access, connected to an SqlServer database.I have run many such functions in Access, that I copied from the web.See my question from yesterday for example: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=96521 .The difference for today is that I am trying to write my first function by myself ... ;>) ...I really would prefer to do that in VB or java or C#, I dislike this SQL stuff ! |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-01 : 03:15:20
|
Ok... Then we move on to the next line in the error message.Put a single GO on the line above "ALTER FUNCTION..." and under ENDGOALTER FUNCTION.......GO E 12°55'05.25"N 56°04'39.16" |
 |
|
lalbatros
Yak Posting Veteran
69 Posts |
Posted - 2008-02-01 : 07:31:41
|
Peso,What is the meaning of this 'GO' ? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
lalbatros
Yak Posting Veteran
69 Posts |
Posted - 2008-02-01 : 15:28:36
|
Looks like chinese for me ;>) !What is a batch, to start with, and why is that important or even necessary?After all, I just wanted to define a simple elementary function, and I know have to learn about batches ... ? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-02-01 : 21:29:42
|
quote: Looks like chinese for me ;>) !
it is in perfect English. If it is in Chinese, i can translate for you  KH[spoiler]Time is always against us[/spoiler] |
 |
|
lalbatros
Yak Posting Veteran
69 Posts |
Posted - 2008-02-02 : 12:12:49
|
khtan,That's probably why you are more confortable than me with tsql ! ;>) |
 |
|
|