Board index » delphi » MS SQL 6.5 vs Local SQL Query

MS SQL 6.5 vs Local SQL Query

I have a simple query that works with MS -SQL 6.5

select
name, course = coursename + courselevel + coursecompany, fullname =
lastname + firstname
from classes

Seems simple enough.  However, if I try to run the same Query (TQuery
Component) using Local SQL on a dBase Table, it seems to have problems
with the calculated fields.  In fact, it also seems
to have problem with renaming a field name.

If I have the simple statement:

select username = name

It doesn't like it either.  Does Local SQL not support Calculated fields
or fieldname re-naming in a Query?? Do you have to use a different
Syntax?

It seems rather odd to me that it would work for MS-SQL, but not for
local SQL.

If anyone has any help, Thanks

Hugh,

 

Re:MS SQL 6.5 vs Local SQL Query


Hi Hugh

They have slightly different syntax for renaming fields. DBase and a few
others I believe use 'AS'

select
name, (coursename + courselevel + coursecompany) As course, (lastname +
firstname) As Fullname
from classes

HTH
Regards
Clint

Quote

> It doesn't like it either.  Does Local SQL not support Calculated
> fields
> or fieldname re-naming in a Query?? Do you have to use a different
> Syntax?

> It seems rather odd to me that it would work for MS-SQL, but not for
> local SQL.

> If anyone has any help, Thanks

Re:MS SQL 6.5 vs Local SQL Query


Change your query to:

select name, coursename + courselevel + coursecompany AS course,
lastname + firstname AS fullname
from classes

This is standard SQL syntax and also works with MS-SQL, so it's
probably something worth standardizing on.

Dave

Quote
hcowan wrote in message <347C61EE.B7BE3...@tcet.com>...
>I have a simple query that works with MS -SQL 6.5

>select
>name, course = coursename + courselevel + coursecompany, fullname =
>lastname + firstname
>from classes

>Seems simple enough.  However, if I try to run the same Query (TQuery
>Component) using Local SQL on a dBase Table, it seems to have problems
>with the calculated fields.  In fact, it also seems
>to have problem with renaming a field name.

>If I have the simple statement:

>select username = name

>It doesn't like it either.  Does Local SQL not support Calculated fields
>or fieldname re-naming in a Query?? Do you have to use a different
>Syntax?

>It seems rather odd to me that it would work for MS-SQL, but not for
>local SQL.

>If anyone has any help, Thanks

>Hugh,

Other Threads