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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 [sql] Syntax error, transaction problem

Author  Topic 

1love
Starting Member

3 Posts

Posted - 2013-01-23 : 11:42:26
Hi,
here is a code:

BEGIN
begin transaction
DECLARE column_not_found
EXCEPTION FOR SQLSTATE '52003';
UPDATE PRACOWNIK
SET IDADRES=29
WHERE IDPRACOWNIK=20;
IF (SELECT IDSTANOWISKO
FROM STANOWISKO
GROUP BY IDSTANOWISKO, PENSJA
HAVING PENSJA=(SELECT MIN(X.PENSJA)
FROM (SELECT IDSTANOWISKO, PENSJA
FROM STANOWISKO
WHERE PENSJA>(SELECT S.PENSJA
FROM STANOWISKO S, PRACOWNIK P
WHERE P.IDSTANOWISKO=S.IDSTANOWISKO AND P.IDPRACOWNIK=20)) X)) IS NULL THEN
BEGIN
SIGNAL column_not_found
END
ENDIF;
commit transaction;
EXCEPTION
WHEN column_not_found THEN
begin
rollback transaction;
MESSAGE 'Column not found handling.' TO CLIENT;
end
WHEN OTHERS THEN
RESIGNAL ;
END


why im getting syntax error near 'TRANSACTION' ?
thx in advance

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-01-23 : 13:33:13
This does not seem to be Transact-SQL. What is the environment you are running this in?
Go to Top of Page
   

- Advertisement -