Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[color green]--drop table #tmpTable[/color]
[color blue]create table[/color] #tmpTable(
intID [color blue]int identity[/color](1,1),
SomeText [color blue]varchar[/color](3))
[color green]--Load table[/color]
[color blue]insert into[/color] #tmpTable(SomeText) [color blue]Values[/color]([color red]'aaa'[/color])
[color blue]insert into[/color] #tmpTable(SomeText) [color blue]Values[/color]([color red]'bbb'[/color])
[color green]--Err Variables[/color]
[color blue]Declare[/color] @LastErrText [color blue]varchar[/color](4000), @LastErrNum [color blue]int[/color], @LastTranCount [color blue]int[/color]
[color blue]Select[/color] @LastErrText = [color red]''[/color], @LastErrNum = 0, @LastTranCount = 0
[color blue]begin try[/color]
[color green]--start transaction[/color]
[color blue]begin tran
update[/color] #tmpTable
[color blue]set[/color] SomeText = [color red]'zzz'[/color]
[color blue]where[/color] SomeText = [color red]'aaa'[/color]
[color green]--Force error to test logic[/color]
[color blue]select[/color] 1/0
[color blue]update[/color] #tmpTable
[color blue]set[/color] SomeText = [color red]'www'[/color]
[color blue]where[/color] someText=[color red]'bbb'[/color]
[color blue]end try
begin catch[/color]
[color green]--save errors[/color]
[color blue]Select[/color] @LastErrText = ERROR_MESSAGE(),
@LastErrNum = Error_Number(),
@LastTranCount = [color fuchsia]@@TranCount[/color]
[color green]--undue any updates that worked[/color]
[color blue]rollback[/color]
[color green]--Optional view errors
--Select @LastErrText , @LastErrNum , @LastTranCount
--Throw an error[/color]
[color blue]RaisError[/color](@LastErrText,16,1)
[color green]--break out[/color]
[color blue]RETURN
end catch[/color]
[color green]--Commit updates[/color]
[color blue]commit tran[/color]
[color green]--show new values[/color]
[color blue]select[/color] * [color blue]from[/color] #tmpTable