rferguson
I'm trying to construct a more complex variable where I'll pass two date variables
.
May I inquire as to why you want to use a a complex variable to pass two dates? Seems it would be much simplier to pass two variables each containing one date to your procedure. Anyway using what you have posted try this:
ALTER PROCEDURE PrintMessage
@variable VARCHAR(30)
@var2 VARCHAR(30)= ' '
AS
PRINT @variable, +' ' + @var2
--testing
DECLARE @variable VARCHAR(30)
SET @Variable = 'Print message'
EXECUTE PrintMessage @Variable, 'some more text'
Result
Print message some more text
or
DECLARE @variable VARCHAR(30)
SET @Variable = 'I will Print message'
EXECUTE PrintMessage @Variable
Result when only one variable is passed to the procedure:
I will Print message
Again I would urge you to follow the KISS principle (Keep It Simple S-----)