-- name type value
DECLARE @PersonId AS UNIQUEIDENTIFIER = 'ddb7bfff-9ce8-4651-6973-08d9a46c90b6'
DECLARE @TABLE TABLE( COL1 INT, COL2 VARCHAR(30))
DECLARE @datecurrent datetime2
set @datecurrent = CAST(getdate() AS smalldatetime)
DECLARE @TableVariable TABLE (Id INT)
INSERT INTO @TableVariable
SELECT Id
FROM TableName
WHERE....
SELECT *
FROM TableName
WHERE Id IN ( SELECT Id FROM @TableVariable)
DECLARE @COURSE_ID AS INT, @COURSE_NAME VARCHAR (10);