Skip to content

SQL Server Four Operations

	@num_1 float,
	@num2 float,
	@total float,
	@subtraction float,
	@Division float,
	@Multiplication float

set @num_1 = 15
set @num2 = 10

set @total = @num_1 + @num2
set @subtraction = @num_1 - @num2
set @Multiplication = @num_1*@num2
set @Division = @num_1/@num2

print 'Total: ' + CAST(@total as varchar(5));
print 'Subtraction: ' + CAST(@subtraction as varchar(5));
print 'Multiplication: ' + CAST(@Multiplication as varchar(5));
print 'Division: ' + CAST(@Division as varchar(5));

Total: 25
Subtraction: 5
Multiplication: 150
Division: 1.5


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: