New Sql Server 2016 Features To Use In Acumatica
04 November 2019
Hello everybody,
today I want to write about new additions for SQL Server T-SQL language, which are there starting from 2016. It is create or alter syntax.
In the past, if you've made some custom SQL view, it was needed to have constructions like this ( pseudo code ):
if view ( stored procedure, function, trigger ) exists
create view ( stored procedure, function, trigger )
else
alter view ( stored procedure, function, trigger )
But startring from 2016 SP1 you can use following syntax ( pseudo code ):
Create or alter view ( stored procedure, function, trigger ).
Or in code form it may look like this:
create or alter procedure yourProcedure as begin print (1) end; go create or alter function yourFunction() returns int as begin return(1) end; go create or alter view yourSqlView as select 1 as col; go create or alter trigger yourTrigger on Product after insert, update
Summary
With those SQL features your code of customizations may become much simpler and less prone to errors