try microsoft.public.sqlserver.programming
DECLARE @MM int
DECLARE @yy int
SET @MM = 8
SET @yy = 2004
DECLARE @w smalldatetime
IF @MM <10
SET @w = CAST(CAST(@yy AS VARCHAR(4)) + '0' + CAST(@MM AS VARCHAR(2))+
'01' AS smalldatetime)
ELSE
SET @w = CAST(CAST(@yy AS VARCHAR(4)) + CAST(@MM AS VARCHAR(2))+ '01' AS
smalldatetime)
PRINT @w
probably not very robust
HTH,
Greg
"walker" <wa****@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
I need the URL for posting questions re SQL. like:
what is the syntax to construct a datetime value form month and year
stored in integer variables and a day constant, such as
@w-datetime = @MM + '01' + @yy
thanks,