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)
 Another question on DATE

Author  Topic 

delpiero
Yak Posting Veteran

98 Posts

Posted - 2005-03-14 : 05:27:05
Hi,

I have a stored procedure which selects a number of columns from a table, including a DATETIME column. The frontend application (Visual FoxPro) would call the stored procedure and stores the results into a cursor.

As we know SQL Server does not separate date and time, how can I let the VFP frontend retrieve the date column (without a time portion) and let it store into the cursor as a real date data type? In doing so, I can't use the convert(varchar,datecol,103) because I want to return a date column and not a varchar column.

Thanks for help.

Regards,
delpiero

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-14 : 05:47:19
sql server always returs date AND time portion. so you'll have to handle that somehow in foxPro.
you can return ie. (dd.mm.yyyy) 14.03.2005 00:00:00:000 with SELECT DATEADD(d, DATEDIFF(d, 0, GetDate()), 0)

Go with the flow & have fun! Else fight the flow
Go to Top of Page

delpiero
Yak Posting Veteran

98 Posts

Posted - 2005-03-15 : 04:20:53
Thanks for the update.

It would not be difficult to implement the conversion in Visual Foxpro, but the problem is we have to address this in many parts of the front-end application, which is extremely time-consuming.

Is there a function like TO_DATE() in Oracle which helps to extract only the date part and remove the time part, even not storing the 00:00:00.000 part of the time? I just want to see if there is any method to truncate the time part. If not, then I can just stick to conversion in VFP.

Thanks,
delpiero
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-03-15 : 04:41:49
try month, year and day functions

--------------------
keeping it simple...
Go to Top of Page

delpiero
Yak Posting Veteran

98 Posts

Posted - 2005-03-15 : 05:07:29
They return integers, but I wish to get a date ...

Thanks,
delpiero
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-03-15 : 05:45:04
SQL Server only has a datetime data type, not a date data type.

You can convert the datetime to a string containg only the date:

select Date = convert(varchar(10), getdate(),111)

returns

Date
----------
2005/03/15

There are many choices for the format of the date. See the CAST/CONVERT function in BOL for details.



CODO ERGO SUM
Go to Top of Page
   

- Advertisement -