Set is used to assign a value to a previously declared variable.
You must first declare the variable with a DECLARE statement.
SET @variable_name = value_type;
Don't forget to end your line with a semicolon
Declare Example |
Copy Code
|
---|---|
DECLARE @myval decimal( 5,2 ); SET @myval = 155.55; SELECT @myval; RETURNS: 155.55 |