0
我下面的代碼,但它給出了一個錯誤,請指導我如何嵌套if..begin..begin__tran__Rollback或承諾If..begin..begin tran..Rollback
declare @acname as varchar(max),
@gstcount as int
set @acname='Party1'
use TESTDB
set @gstcount = (select count(GSTIN) from M_STATEWISEGSTINACTAG where GSTIN<>'UNREGISTERED' AND ACCD=
(select accd from m_ledger where descr LIKE @acname))
if @gstcount = 1
begin
--multiple select statments
select .......
--to display require info.
end
--Then Update Values
begin tran;
update M_tbl ........where....
--Show result with updated value
select * from M_tbl........where.........
--Undo Changes
ROLLBACK;
else
begin
SELECT ........reuqir info
end;
在此腳本我得到一個錯誤'關鍵字'else'附近的語法不正確。
我檢查與終端,終端;,年底陳德良,結束TRAN;它仍然給我一個相同的行號錯誤 –