Global TSQL Variable
This is so obvious. Either use a local temp table or a utility table!
DECLARE @target_date date; SET @target_date='01/01/2016'; if object_id('tempdb..#vars') is not null drop table #vars; CREATE table #vars (tgt varchar(20), res date); insert #vars values ('target_date',@target_date); GO DECLARE @target_date date; SET @target_date=(SELECT res FROM #vars WHERE tgt='target_date');