Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getdate in SP

Status
Not open for further replies.

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 !
 
hello,

please check out the 'Using dates in SPs' reply postings in the Sybase: Adaptive Server forum...

ty,
q.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top