SlideShare uma empresa Scribd logo
1 de 9
Piggy Bank

Introduction:

For this project, I was responsible for creating the database and developing the T-SQL stored
procedures for banking system. The Data Access tier utilizes stored T-SQL procedures to
query and update SQL Server database tables. Within each stored procedure, I implemented
data validation and proper error handling techniques. Exceptions return a specified error
code back to the Data Access tier, where customized error handling takes place. If the stored
procedure completes without exception, values are assigned to the appropriate object
properties and passed back to the Windows Application through the business tier. The
business tier acts as a middle tier between the Windows Application tier and the Data Access
tier, handling all calls to the to the Data Access tier.




Audience:

This project is designed for bank personal to carry out typical bank functions, such as
adding accounts and making withdrawals.. The stored procedures were designed to be
easy to use.



Project Goals:

   •   Develop code that is easily maintainable.

   •   Provide adequate error handling.

   •   Use database-programming techniques that provide maximum programming
       flexibility and control while minimizing resource utilization.
SQL Stored Procedure

Create Procedure

USE [PiggyBank]
GO
/****** Object: StoredProcedure [dbo].[usp_MakeWithdrawal]   Script Date:
06/30/2009 13:04:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[usp_MakeWithdrawal]
(
  @AcctID             int        ,
  @CustID             int        ,
  @TransAmt           money      ,
  @TransID            int   output
  )

as

declare

 @TransDt           datetime   ,
 @CurrBal           money      ,
 @NewBal            money      ,
 @AcctStat          tinyint    ,
 @OvrDftBal         money      ,
 @OvrNewBal         money      ,
 @GenOvrDft         bit        ,
 @OvrDftFee         money      ,
 @GenOvrFee         money      ,
 @OvrDftID          int        ,
 @wd_flg            bit        ,
 @TransTypID        tinyint



 set @wd_flg       = 0
 set @OvrDftFee    = 10
 set @GenOvrFee    = 30
Validation and Error Checking



if (@AcctID    is NULL) or (@AcctID = '')
              begin
                  raiserror('Invalid Account ID',11,1)
                  return
              end


     if (@CustID    is NULL) or (@CustID   = '')
            begin
                 raiserror('Invalid Customer ID',11,1)
                 return
            end


   if (@TransAmt is null) or ( @TransAmt = '') or (@TransAmt = 0)
            begin
                raiserror('Incorrect Transaction Amount',11,1)
                return
            end



     if not exists (select * from CustomerAccount where AccountID = @AcctID
and CustomerID =@CustID)
           begin
                 raiserror('Customer does not belong to this account',11,1)
                 return
            end


   select   @AcctStat = AccountStatusID from account where AccountID = @AcctID


     if @AcctStat     <> 1
            begin
                     raiserror ('Account is inactive',11,1)
                     return
              end
select @OvrDftID = OverDraftAccountID from Account where AccountID = @AcctID

if ((@OvrDftID is not null) or (@OvrDftID           <> '')) and exists (select * from
Account where AccountID = @OvrDftID )

       begin

      select      @OvrDftBal = CurrentBalance from Account where AccountID        =
@OvrDftID

       end


else

    set @OvrDftBal = 0



   select @CurrBal = CurrentBalance from account where AccountID = @AcctID

   select @GenOvrDft = OverDraftAccountID from Account where AccountID =
@AcctID

   if (@OvrDftBal is null) or (@OvrDftBal = '')
       begin
         set @OvrDftBal = 0
        end



 --set       @NewBal    =    @CurrBal + @TransAmt

   set       @TransDt    =   GetDate()

   set       @TransTypID = 3
Insert Statements in Try/Catch Block

begin try


   begin tran

   if    @TransAmt <= @CurrBal

   begin




    set @NewBal    =   @CurrBal - @TransAmt

    insert into Transactions(AccountID, TransactionTypeID,CustomerID,
TransactionDate, TransactionAmount, NewBalance)
        values(@AcctID, @TransTypID, @CustID, @TransDt, @TransAmt, @NewBal)

    set @TransID = scope_identity()


     update Account

         set CurrentBalance =    @NewBal

     Where AccountID = @AcctID


    set @wd_flg = 1


   end
if    (@TransAmt > @CurrBal) and (@OvrDftBal >= @TransAmt )

      begin


      set @OvrNewBal    =   @OvrDftBal - @TransAmt


    insert into Transactions(AccountID, TransactionTypeID,CustomerID,
TransactionDate, TransactionAmount, NewBalance)
       values(@OvrDftID, @TransTypID, @CustID, @TransDt, @TransAmt,
@OvrNewBal)

      set @TransID = scope_identity()


       update Account

         set CurrentBalance =    @OvrNewBal

       Where AccountID = @OvrDftID



  set @NewBal    =   @CurrBal - @OvrDftFee

    insert into Transactions(AccountID, TransactionTypeID,CustomerID,
TransactionDate, TransactionAmount, NewBalance)
          values(@AcctID, @TransTypID, @CustID, @TransDt, @OvrDftFee, @NewBal)

      set @TransID = scope_identity()


   update Account

         set CurrentBalance =    @NewBal

       Where AccountID = @AcctID


   update Account

         set OverDraftDt =    @TransDt

       Where AccountID = @AcctID


  set @wd_flg = 1


end




if (@TransAmt > @CurrBal)       and (@TransAmt > @OvrDftBal) and (@TransAmt <
400) and ( @GenOvrDft = 1)
begin


       set @NewBal = @CurrBal - @TransAmt

     insert into Transactions(AccountID, TransactionTypeID,CustomerID,
TransactionDate, TransactionAmount, NewBalance)
      values(@AcctID, @TransTypID, @CustID, @TransDt, @TransAmt, @NewBal)

    set @TransID = scope_identity()



    update Account

        set CurrentBalance =   @NewBal

    Where AccountID = @AcctID




       set @NewBal = @NewBal - @GenOvrFee


     insert into Transactions(AccountID, TransactionTypeID,CustomerID,
TransactionDate, TransactionAmount, NewBalance)
      values(@AcctID, @TransTypID, @CustID, @TransDt, @GenOvrFee, @NewBal)

    set @TransID = scope_identity()




    update Account

        set CurrentBalance =   @NewBal

    Where AccountID = @AcctID



  update Account

        set OverDraftDt =   @TransDt

    Where AccountID = @AcctID



   set @wd_flg = 1

 end
if @wd_flg <> 1
        begin
         print 'Withdrawal Denied'
        end



 commit tran


end try




Error Handlin


begin catch -- raise an error to pass up the line if one was caught
      DECLARE @ErrorMessage NVARCHAR(4000);
            DECLARE @ErrorSeverity INT;
            DECLARE @ErrorState INT;
            SELECT
                   @ErrorMessage = ERROR_MESSAGE(),
                   @ErrorSeverity = ERROR_SEVERITY(),
                   @ErrorState = ERROR_STATE()
            RAISERROR (@ErrorMessage, -- Message text.
                             @ErrorSeverity, -- Severity.
                             @ErrorState -- State.
                           )
end catch
Marcus  Portfolio

Mais conteúdo relacionado

Mais procurados

IP project for class 12 cbse
IP project for class 12 cbseIP project for class 12 cbse
IP project for class 12 cbsesiddharthjha34
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERDarwin Durand
 
Extending Redux in the Server Side
Extending Redux in the Server SideExtending Redux in the Server Side
Extending Redux in the Server SideIgnacio Martín
 
Dependency rejection and TDD without Mocks
Dependency rejection and TDD without MocksDependency rejection and TDD without Mocks
Dependency rejection and TDD without MocksAntya Dev
 
Resiliency & Security_Ballerina Day CMB 2018
Resiliency & Security_Ballerina Day CMB 2018  Resiliency & Security_Ballerina Day CMB 2018
Resiliency & Security_Ballerina Day CMB 2018 Ballerina
 
A Mock to far - GeeCon
A Mock to far -  GeeConA Mock to far -  GeeCon
A Mock to far - GeeConMichał Lipski
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)Darwin Durand
 
Michał Kopacz: Ports and adapters architecture for business processes
Michał Kopacz: Ports and adapters architecture for business processesMichał Kopacz: Ports and adapters architecture for business processes
Michał Kopacz: Ports and adapters architecture for business processesRST Software Masters
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent codeDror Helper
 
Deep Dive into React Hooks
Deep Dive into React HooksDeep Dive into React Hooks
Deep Dive into React HooksFelix Kühl
 
Promise: async programming hero
Promise: async programming heroPromise: async programming hero
Promise: async programming heroThe Software House
 

Mais procurados (20)

Ip project
Ip projectIp project
Ip project
 
IP project for class 12 cbse
IP project for class 12 cbseIP project for class 12 cbse
IP project for class 12 cbse
 
Jason parsing
Jason parsingJason parsing
Jason parsing
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
 
Mock geecon2
Mock geecon2Mock geecon2
Mock geecon2
 
Extending Redux in the Server Side
Extending Redux in the Server SideExtending Redux in the Server Side
Extending Redux in the Server Side
 
Dependency rejection and TDD without Mocks
Dependency rejection and TDD without MocksDependency rejection and TDD without Mocks
Dependency rejection and TDD without Mocks
 
Resiliency & Security_Ballerina Day CMB 2018
Resiliency & Security_Ballerina Day CMB 2018  Resiliency & Security_Ballerina Day CMB 2018
Resiliency & Security_Ballerina Day CMB 2018
 
A Mock to far - GeeCon
A Mock to far -  GeeConA Mock to far -  GeeCon
A Mock to far - GeeCon
 
Spring Transaction
Spring TransactionSpring Transaction
Spring Transaction
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)
 
Michał Kopacz: Ports and adapters architecture for business processes
Michał Kopacz: Ports and adapters architecture for business processesMichał Kopacz: Ports and adapters architecture for business processes
Michał Kopacz: Ports and adapters architecture for business processes
 
Logging in code
Logging in codeLogging in code
Logging in code
 
C programming
C programmingC programming
C programming
 
An intro to cqrs
An intro to cqrsAn intro to cqrs
An intro to cqrs
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent code
 
Deep Dive into React Hooks
Deep Dive into React HooksDeep Dive into React Hooks
Deep Dive into React Hooks
 
React with Redux
React with ReduxReact with Redux
React with Redux
 
Promise: async programming hero
Promise: async programming heroPromise: async programming hero
Promise: async programming hero
 
Spring 2.5
Spring 2.5Spring 2.5
Spring 2.5
 

Destaque

Essential things that should always be in your car
Essential things that should always be in your carEssential things that should always be in your car
Essential things that should always be in your carEason Chan
 
Activism x Technology
Activism x TechnologyActivism x Technology
Activism x TechnologyWebVisions
 
The Near Future of CSS
The Near Future of CSSThe Near Future of CSS
The Near Future of CSSRachel Andrew
 
How to Battle Bad Reviews
How to Battle Bad ReviewsHow to Battle Bad Reviews
How to Battle Bad ReviewsGlassdoor
 
Classroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and AdolescentsClassroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and AdolescentsShelly Sanchez Terrell
 
The Buyer's Journey - by Chris Lema
The Buyer's Journey - by Chris LemaThe Buyer's Journey - by Chris Lema
The Buyer's Journey - by Chris LemaChris Lema
 
The Presentation Come-Back Kid
The Presentation Come-Back KidThe Presentation Come-Back Kid
The Presentation Come-Back KidEthos3
 

Destaque (7)

Essential things that should always be in your car
Essential things that should always be in your carEssential things that should always be in your car
Essential things that should always be in your car
 
Activism x Technology
Activism x TechnologyActivism x Technology
Activism x Technology
 
The Near Future of CSS
The Near Future of CSSThe Near Future of CSS
The Near Future of CSS
 
How to Battle Bad Reviews
How to Battle Bad ReviewsHow to Battle Bad Reviews
How to Battle Bad Reviews
 
Classroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and AdolescentsClassroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and Adolescents
 
The Buyer's Journey - by Chris Lema
The Buyer's Journey - by Chris LemaThe Buyer's Journey - by Chris Lema
The Buyer's Journey - by Chris Lema
 
The Presentation Come-Back Kid
The Presentation Come-Back KidThe Presentation Come-Back Kid
The Presentation Come-Back Kid
 

Semelhante a Marcus Portfolio

Shangz R Brown Presentation
Shangz R Brown PresentationShangz R Brown Presentation
Shangz R Brown Presentationshangbaby
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd marchRajeev Sharan
 
help me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdfhelp me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdfarihantmum
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right wayThibaud Desodt
 
foreach (DataRow dataRow in dataTable.Rows) .docx
            foreach (DataRow dataRow in dataTable.Rows)        .docx            foreach (DataRow dataRow in dataTable.Rows)        .docx
foreach (DataRow dataRow in dataTable.Rows) .docxjoyjonna282
 
Barcelona Developers Conference 2011
Barcelona Developers Conference 2011Barcelona Developers Conference 2011
Barcelona Developers Conference 2011PayPal
 
Advanced dot net
Advanced dot netAdvanced dot net
Advanced dot netssa2010
 
WebIT PayPal Standard Product
WebIT PayPal Standard ProductWebIT PayPal Standard Product
WebIT PayPal Standard ProductPayPal
 
Webit expo Standard Product
Webit expo Standard ProductWebit expo Standard Product
Webit expo Standard ProductBoji Ditcheva
 
#include iostream #include BankAccountClass.cpp #include .pdf
#include iostream #include BankAccountClass.cpp #include .pdf#include iostream #include BankAccountClass.cpp #include .pdf
#include iostream #include BankAccountClass.cpp #include .pdfANJANEYAINTERIOURGAL
 
Cooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureCooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureJeroen Rosenberg
 
WEB DESIGN PRACTICLE bca
WEB DESIGN PRACTICLE bcaWEB DESIGN PRACTICLE bca
WEB DESIGN PRACTICLE bcaYashKoli22
 
YASH HTML CODES
YASH HTML CODESYASH HTML CODES
YASH HTML CODESYashKoli22
 
YASH HTML CODE
YASH HTML CODE YASH HTML CODE
YASH HTML CODE YashKoli22
 

Semelhante a Marcus Portfolio (20)

Shangz R Brown Presentation
Shangz R Brown PresentationShangz R Brown Presentation
Shangz R Brown Presentation
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
help me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdfhelp me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdf
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfolio
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
 
project
projectproject
project
 
foreach (DataRow dataRow in dataTable.Rows) .docx
            foreach (DataRow dataRow in dataTable.Rows)        .docx            foreach (DataRow dataRow in dataTable.Rows)        .docx
foreach (DataRow dataRow in dataTable.Rows) .docx
 
Add invoice
Add invoiceAdd invoice
Add invoice
 
Barcelona Developers Conference 2011
Barcelona Developers Conference 2011Barcelona Developers Conference 2011
Barcelona Developers Conference 2011
 
Dat402
Dat402Dat402
Dat402
 
Advanced dot net
Advanced dot netAdvanced dot net
Advanced dot net
 
Ss
SsSs
Ss
 
Transaction
TransactionTransaction
Transaction
 
WebIT PayPal Standard Product
WebIT PayPal Standard ProductWebIT PayPal Standard Product
WebIT PayPal Standard Product
 
Webit expo Standard Product
Webit expo Standard ProductWebit expo Standard Product
Webit expo Standard Product
 
#include iostream #include BankAccountClass.cpp #include .pdf
#include iostream #include BankAccountClass.cpp #include .pdf#include iostream #include BankAccountClass.cpp #include .pdf
#include iostream #include BankAccountClass.cpp #include .pdf
 
Cooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureCooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal Architecture
 
WEB DESIGN PRACTICLE bca
WEB DESIGN PRACTICLE bcaWEB DESIGN PRACTICLE bca
WEB DESIGN PRACTICLE bca
 
YASH HTML CODES
YASH HTML CODESYASH HTML CODES
YASH HTML CODES
 
YASH HTML CODE
YASH HTML CODE YASH HTML CODE
YASH HTML CODE
 

Marcus Portfolio

  • 1. Piggy Bank Introduction: For this project, I was responsible for creating the database and developing the T-SQL stored procedures for banking system. The Data Access tier utilizes stored T-SQL procedures to query and update SQL Server database tables. Within each stored procedure, I implemented data validation and proper error handling techniques. Exceptions return a specified error code back to the Data Access tier, where customized error handling takes place. If the stored procedure completes without exception, values are assigned to the appropriate object properties and passed back to the Windows Application through the business tier. The business tier acts as a middle tier between the Windows Application tier and the Data Access tier, handling all calls to the to the Data Access tier. Audience: This project is designed for bank personal to carry out typical bank functions, such as adding accounts and making withdrawals.. The stored procedures were designed to be easy to use. Project Goals: • Develop code that is easily maintainable. • Provide adequate error handling. • Use database-programming techniques that provide maximum programming flexibility and control while minimizing resource utilization.
  • 2. SQL Stored Procedure Create Procedure USE [PiggyBank] GO /****** Object: StoredProcedure [dbo].[usp_MakeWithdrawal] Script Date: 06/30/2009 13:04:10 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[usp_MakeWithdrawal] ( @AcctID int , @CustID int , @TransAmt money , @TransID int output ) as declare @TransDt datetime , @CurrBal money , @NewBal money , @AcctStat tinyint , @OvrDftBal money , @OvrNewBal money , @GenOvrDft bit , @OvrDftFee money , @GenOvrFee money , @OvrDftID int , @wd_flg bit , @TransTypID tinyint set @wd_flg = 0 set @OvrDftFee = 10 set @GenOvrFee = 30
  • 3. Validation and Error Checking if (@AcctID is NULL) or (@AcctID = '') begin raiserror('Invalid Account ID',11,1) return end if (@CustID is NULL) or (@CustID = '') begin raiserror('Invalid Customer ID',11,1) return end if (@TransAmt is null) or ( @TransAmt = '') or (@TransAmt = 0) begin raiserror('Incorrect Transaction Amount',11,1) return end if not exists (select * from CustomerAccount where AccountID = @AcctID and CustomerID =@CustID) begin raiserror('Customer does not belong to this account',11,1) return end select @AcctStat = AccountStatusID from account where AccountID = @AcctID if @AcctStat <> 1 begin raiserror ('Account is inactive',11,1) return end
  • 4. select @OvrDftID = OverDraftAccountID from Account where AccountID = @AcctID if ((@OvrDftID is not null) or (@OvrDftID <> '')) and exists (select * from Account where AccountID = @OvrDftID ) begin select @OvrDftBal = CurrentBalance from Account where AccountID = @OvrDftID end else set @OvrDftBal = 0 select @CurrBal = CurrentBalance from account where AccountID = @AcctID select @GenOvrDft = OverDraftAccountID from Account where AccountID = @AcctID if (@OvrDftBal is null) or (@OvrDftBal = '') begin set @OvrDftBal = 0 end --set @NewBal = @CurrBal + @TransAmt set @TransDt = GetDate() set @TransTypID = 3
  • 5. Insert Statements in Try/Catch Block begin try begin tran if @TransAmt <= @CurrBal begin set @NewBal = @CurrBal - @TransAmt insert into Transactions(AccountID, TransactionTypeID,CustomerID, TransactionDate, TransactionAmount, NewBalance) values(@AcctID, @TransTypID, @CustID, @TransDt, @TransAmt, @NewBal) set @TransID = scope_identity() update Account set CurrentBalance = @NewBal Where AccountID = @AcctID set @wd_flg = 1 end
  • 6. if (@TransAmt > @CurrBal) and (@OvrDftBal >= @TransAmt ) begin set @OvrNewBal = @OvrDftBal - @TransAmt insert into Transactions(AccountID, TransactionTypeID,CustomerID, TransactionDate, TransactionAmount, NewBalance) values(@OvrDftID, @TransTypID, @CustID, @TransDt, @TransAmt, @OvrNewBal) set @TransID = scope_identity() update Account set CurrentBalance = @OvrNewBal Where AccountID = @OvrDftID set @NewBal = @CurrBal - @OvrDftFee insert into Transactions(AccountID, TransactionTypeID,CustomerID, TransactionDate, TransactionAmount, NewBalance) values(@AcctID, @TransTypID, @CustID, @TransDt, @OvrDftFee, @NewBal) set @TransID = scope_identity() update Account set CurrentBalance = @NewBal Where AccountID = @AcctID update Account set OverDraftDt = @TransDt Where AccountID = @AcctID set @wd_flg = 1 end if (@TransAmt > @CurrBal) and (@TransAmt > @OvrDftBal) and (@TransAmt < 400) and ( @GenOvrDft = 1)
  • 7. begin set @NewBal = @CurrBal - @TransAmt insert into Transactions(AccountID, TransactionTypeID,CustomerID, TransactionDate, TransactionAmount, NewBalance) values(@AcctID, @TransTypID, @CustID, @TransDt, @TransAmt, @NewBal) set @TransID = scope_identity() update Account set CurrentBalance = @NewBal Where AccountID = @AcctID set @NewBal = @NewBal - @GenOvrFee insert into Transactions(AccountID, TransactionTypeID,CustomerID, TransactionDate, TransactionAmount, NewBalance) values(@AcctID, @TransTypID, @CustID, @TransDt, @GenOvrFee, @NewBal) set @TransID = scope_identity() update Account set CurrentBalance = @NewBal Where AccountID = @AcctID update Account set OverDraftDt = @TransDt Where AccountID = @AcctID set @wd_flg = 1 end
  • 8. if @wd_flg <> 1 begin print 'Withdrawal Denied' end commit tran end try Error Handlin begin catch -- raise an error to pass up the line if one was caught DECLARE @ErrorMessage NVARCHAR(4000); DECLARE @ErrorSeverity INT; DECLARE @ErrorState INT; SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE() RAISERROR (@ErrorMessage, -- Message text. @ErrorSeverity, -- Severity. @ErrorState -- State. ) end catch