Search notes:

SQL Server T-SQL: assign values to a variable with the set statement

The set statement is used to assign values to a variable.
declare
   @var_1 varchar(10),
   @var_2 integer;

set @var_1 = 'one';
set @var_2 =  2;

print('Var_1 = ' + @var_1 + ', var_2 = ' + trim(str(@var_2)));
Github repository about-MSSQL, path: /t-sql/statements/set/assign-variables/basic.sql
Alternatively, values can be assigned to variables with a select statement.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759397906, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQL-Server/T-SQL/statements/set/assign-variables/index(46): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78