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)
 SQL DateTime Help needed

Author  Topic 

JeffS23
Posting Yak Master

212 Posts

Posted - 2007-07-12 : 17:15:24
I am having issues with Two lines in my Stored Procedure:

'426.Ins1EffectiveDate'=CASE WHEN ISNULL(CONVERT(VARCHAR,pi.InsCardEffectiveDate,101),'')IS NULL THEN '' ELSE CAST(pi.InsCardEffectiveDate AS varchar)END,
'427.Ins1TerminationDate'= CASE WHEN ISNULL(CONVERT(VARCHAR,pi.InsCardTerminationDate,101),'')IS NULL THEN '' ELSE CAST(pi.InsCardTerminationDate AS varchar)END

Its returning a date value as such:

Mar 12 2008 12:00AM

I dont want the 12:00 AM ... in fact, I want it to read 03/12/2008

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-07-12 : 17:37:53
Use the CONVERT function and select the correct value for style.

You can look up the value you want in SQL Server Books Online in the "CAST and CONVERT" topic.

CODO ERGO SUM
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-07-13 : 00:25:03
Where do you want to show formatted dates?
Also what do you mean by '426.Ins1EffectiveDate'?

Madhivanan

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

- Advertisement -