Guest_imported
New member
- Jan 1, 1970
- 0
I want to use getdate() in a SYBASE Stored Procedure,
but can’t get leading zeros for month & day.
create procedure xxxx
as
declare @v_year numeric
declare @v_month numeric
(also smallint & integer & numeric(2))
declare @v_day numeric
select @v_year = (select datepart(year,getdate()))
select @v_month = (select datepart(month,getdate()))
select @v_day = (select datepart(day,getdate()))
select @v_year, @v_month, @v_day
xxxx returns :-
----------------- ------------------ -------------------
2002 7 5
I have tried all sorts of definitions for v_month & v_day,
and adding 00 to them as part of the selects,
but no matter what, I can’t turn them into 07 & 05.
I need to insert into a table a date field with 20020705
Help !
but can’t get leading zeros for month & day.
create procedure xxxx
as
declare @v_year numeric
declare @v_month numeric
(also smallint & integer & numeric(2))
declare @v_day numeric
select @v_year = (select datepart(year,getdate()))
select @v_month = (select datepart(month,getdate()))
select @v_day = (select datepart(day,getdate()))
select @v_year, @v_month, @v_day
xxxx returns :-
----------------- ------------------ -------------------
2002 7 5
I have tried all sorts of definitions for v_month & v_day,
and adding 00 to them as part of the selects,
but no matter what, I can’t turn them into 07 & 05.
I need to insert into a table a date field with 20020705
Help !