Groups > dBase > dBase SQL Servers > Re: cast datetime as Time




cast datetime as Time

cast datetime as Time
Sun, 17 Feb 2008 22:42:02 -060
SELECT recDateTime, CAST(recDateTime AS TIME)
SELECT SUBSTRING(CAST(recDateTime AS char(22)) FROM 11)

Both of the above work fine on local sql but neither work on the SQL server

Any help on this would be appreciated.

Larry Kinder

Post Reply
Re: cast datetime as Time
Mon, 18 Feb 2008 01:26:26 -050
In article <W#PwytecIHA.1952@news-server>, LarryKinder@insightbb.com 
says...
> SELECT recDateTime, CAST(recDateTime AS TIME)
> SELECT SUBSTRING(CAST(recDateTime AS char(22)) FROM 11)
> 
> Both of the above work fine on local sql but neither work on the SQL
server
> 
> Any help on this would be appreciated.
> 
> Larry Kinder
> 

Larry,

When you say they don't work, what does that mean? Error messages? It 
works but does something different?

Are you doing this in a QUERY object? Which version of dBASE and of SQL 
Server?

-- 
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
Post Reply
Re: cast datetime as Time
Mon, 18 Feb 2008 07:27:36 -060
>> SELECT recDateTime, CAST(recDateTime AS TIME)
Server Error:  [Microsoft][ODBC SQL Server Driver][SQL Server]Type time is 
not a defined system type.

>> SELECT SUBSTRING(CAST(recDateTime AS char(22)) FROM 11)
Server Error:  [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect 
syntax near the keyword 'FROM'.

Larry


"Geoff Wass [dBVIPS]" <gswassREMOVE_ME@attglobal.net> wrote in
message 
news:MPG.2222ef13d95cdf64989f19@news.dbase.com...
> In article <W#PwytecIHA.1952@news-server>, LarryKinder@insightbb.com
> says...
>> SELECT recDateTime, CAST(recDateTime AS TIME)
>> SELECT SUBSTRING(CAST(recDateTime AS char(22)) FROM 11)
>>
>> Both of the above work fine on local sql but neither work on the SQL 
>> server
>>
>> Any help on this would be appreciated.
>>
>> Larry Kinder
>>
>
> Larry,
>
> When you say they don't work, what does that mean? Error messages? It
> works but does something different?
>
> Are you doing this in a QUERY object? Which version of dBASE and of SQL
> Server?
>
> -- 
> Geoff Wass [dBVIPS]
> Montréal, Québec, Canada
>
> .|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
> .|.|.| ---------------------------------------------------------- |.|.|.
> .|.|.|             IT Consultant http://Geoff_Wass.com            |.|.|. 

Post Reply
Re: cast datetime as Time
Mon, 18 Feb 2008 11:24:58 +010
Larry Kinder schrieb:
> SELECT recDateTime, CAST(recDateTime AS TIME)

works perfectly with firebird.
Check the documentation of your SQL server how a DateTime should be 
Post Reply
Re: cast datetime as Time
Mon, 18 Feb 2008 14:48:32 +010
Larry Kinder schrieb:
>>> SELECT recDateTime, CAST(recDateTime AS TIME)
> Server Error:  [Microsoft][ODBC SQL Server Driver][SQL Server]Type time is

> not a defined system type.


which driver are you using? Maybe either the driver does not support 
DATE and TIME separately or the server does not.


For example, Firebird 1.0.x was not supporting it.
Interbase until and including 5.6 was not supporting it.


Using either one of these serverversions or below _OR_ using an old 
client.dll/odbc-driver would result in such an error like the one you 
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact