Transact-SQL reference for using DECLARE to define local variables for use in a batch or procedure. Variables are declared in the body of a batch or procedure with the DECLARE statement and are ...
Here’s a SQL keyword you didn’t learn in school that will level-up your code: DECLARE DECLARE is how you define variables in SQL! You can use these variables later in your query. How does it work?