Transaction SQL (operator function) in SQL Server


Here we can use the T-SQL statement like using operator as we use in ASP.net code behind file. We can use it in T-SQL statement as below statement, It saves time and speed up performance also. Try it...

--T-SQL Syntax using Operator

DECLARE @cnt AS INT = 2

SET @cnt += 1

PRINT 'This is the Addition '+Convert(varchar(12),@cnt)

SET @cnt = @cnt * 2

--PRINT @cnt

PRINT 'This is the Multiplication '+Convert(varchar(12),@cnt)

SET @cnt = @cnt / 2

PRINT 'This is the Division '+Convert(varchar(12),@cnt)

Comments