This is some code I ran against one of my SQL Tables (joined is SQL date and 
timestamp is SQL datetime):

LOCAL n As Integer, c As String
n = SQLCONNECT()&& Get a connection handle
c = [SELECT joined, timestamp FROM members WHERE id = 45]
SQLEXEC(n, c, "test")
? VARTYPE(test.joined)&& Prints D
? VARTYPE(test.timestamp)&& Prints T

Hope this helps.

Laurie


________________________________
 From: Kent Belan <[email protected]>
To: 'ProFox Email List' <[email protected]> 
Sent: Friday, 13 December 2013, 23:31
Subject: RE: VFP9 accessing SQL server data
 

Hello,

I asked this question previously and I appreciate all the help I received.

I had to work on other projects and now I am back on this SQL project.

I have everything working great except for date fields.

I am using the West Wind business object classes and the wwSQL class to do
the queries.

I have tried several options in my select statement but not having much luck

CAST(t_date as date) returns a character string
CAST(t_date as datetime) returns a datetime field
CONVERT(CHAR(10), t_date,101) returns the date in the correct format
MM/DD/YYYY but still in character string

Is there a way to execute the query and get a DATE type field back ?

Thanks,
Kent



-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Kent Belan
Sent: Wednesday, October 16, 2013 9:18 PM
To: 'ProFox Email List'
Subject: VFP9 accessing SQL server data

Hello,

I have been using VFP for years but this is the first time I have had to
access data from an SQL server.

I have the connection made and I can pull a query successfully.

Here is my question:
The date fields are coming over as character in 2013-10-16 format. Is there
a way to get date fields or do I have to convert them ?

Also there are many character fields that instead of being blank have .NULL.

Do I need to convert these also ?

What is the best way to convert the data or is there a way to tell SQL
server to send it better ?

This is probably very basic for most of you ...

Any help is appreciated,
Thanks,
Kent


[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to