SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 [sql] Syntax error, transaction problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

1love
Starting Member

3 Posts

Posted - 01/23/2013 :  11:42:26  Show Profile  Reply with Quote
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

Edited by - 1love on 01/23/2013 13:03:51

James K
Flowing Fount of Yak Knowledge

3705 Posts

Posted - 01/23/2013 :  13:33:13  Show Profile  Reply with Quote
This does not seem to be Transact-SQL. What is the environment you are running this in?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000