Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Convert function not return expected value

Author  Topic 

ryanlcs
Yak Posting Veteran

62 Posts

Posted - 2010-03-24 : 21:54:58
Hi

I run this statement in the query analyzer, it will return me '03/25/2010', which is what I expected.
select convert(varchar(10), getDate(), 101)

BUT, when I put it in stored proc,it returns me 'Mar 25 201'. The variable @date will retrieve the date value from table.
select convert(varchar(10), @date, 101)

Please advice.

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-03-25 : 00:36:50
Is any date format is set in SP using
set dateformat <format>

Regards,
Bohra
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-25 : 03:23:33
Post the code used in the procedure

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-03-25 : 04:24:56
What datatype is variable @date?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -