dannystommen
May 14th, 2009, 11:27 AM
I'm trying to declare a variable:
BEGIN
DECLARE @test INT;
SET @test = 5;
SELECT @test;
END;
When I try to execute the code using mysql query browser, the declare line fails, but the set line succeeds. Finally when I run the select line '5' is displayed.
But even when I change SET @test = 5; to SET @test = 'test'; this line also succeeds and the select line shows 'test'.
What am I doing wrong. I want to execute this code from within my webapplication, but it immediatly fails on the first line, and everything after it is not executed.
BEGIN
DECLARE @test INT;
SET @test = 5;
SELECT @test;
END;
When I try to execute the code using mysql query browser, the declare line fails, but the set line succeeds. Finally when I run the select line '5' is displayed.
But even when I change SET @test = 5; to SET @test = 'test'; this line also succeeds and the select line shows 'test'.
What am I doing wrong. I want to execute this code from within my webapplication, but it immediatly fails on the first line, and everything after it is not executed.