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 2000 Forums
 SQL Server Development (2000)
 Can't get just the date from a Stored Proc?

Author  Topic 

label
Posting Yak Master

197 Posts

Posted - 2003-02-14 : 12:54:10
I'm trying to return just the date from a query I've written (see below) and instead I continually get the whole date and time string. Is there any way to remove the time and just return the Date in short format?

I've currently tried using the "convert" function and tried applying the "101" style in order to return a short date but I keep getting the time regardless of this convert function.

Any ideas on what I can do?

Thanks in advance.

example:

CREATE PROCEDURE dbo.ap_get_user_info_dt

@userid int

AS

Begin

Set nocount on

select us.[user_id], (us.firstname + ' ' + us.lastname) as full_name, us.email, (us.phone + ' ' + us.phone_ext) as Phone, ur.user_last_login, convert(datetime, ur.user_create_time, 101) as user_create_time, us.city, us.state, us.country, us.company_name, us.job, us.industry
from smc_new_products.dbo.usr_smc us
join
smc_new_products.dbo.usr ur on us.[user_id]=ur.[user_id]
where us.[user_id]=@userid

End
GO


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-02-14 : 13:02:24
If you convert it to varchar, it will work. So:

convert(varchar(10), ur.user_create_time, 101)

Go to Top of Page

label
Posting Yak Master

197 Posts

Posted - 2003-02-14 : 13:28:00
quote:

If you convert it to varchar, it will work. So:
convert(varchar(10), ur.user_create_time, 101)



Great, that worked!

Thanks.

Go to Top of Page
   

- Advertisement -