Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 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

3873 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  
 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.04 seconds. Powered By: Snitz Forums 2000