?
Solved

Local SQL select for date=today

Posted on 2006-07-11
16
Medium Priority
?
2,178 Views
Last Modified: 2008-01-09
Hi team,

I'm trying to limit my extract from two tables to those records where ufsale = today

SELECT (trim(both " " from key1)+"/0 "+ g1.company) as receivercompany,
ulocname as locationname,
g1.zip as costcentre,
g1.contact as receiverattn,g1.phone1 as receiverph,
g1.address1,
g1.address2,
g1.city as address3
from Contact1 g1, contact2 g2
where g1.accountno =g2.accountno
and ufsale=getdate()

Using Access or SQL Server this would work fine, but for Local SQL what is the syntax for where ufsale=today?

Urgent help required for a simple question, note it is "Local SQL" as in Paradox,xBase

All help is appreciated.



Cheers
Bernard
0
Comment
Question by:BernardGBailey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
  • +2
16 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17085629
>and ufsale=getdate()

and ufsale>= convert(datetime, convert(varchar(10), getdate(), 120), 120)
and ufsale< dateadd(day, 1,convert(datetime, convert(varchar(10), getdate(), 120), 120))
0
 

Author Comment

by:BernardGBailey
ID: 17085693
Hi AngelIII,

No joy with either,

Invalid use of keyword
Token:varchar(10)

I like the speed of response though :)

Cheers
Bernard
0
 
LVL 14

Expert Comment

by:sathyagiri
ID: 17085809
SELECT (trim(both " " from key1)+"/0 "+ g1.company) as receivercompany,
ulocname as locationname,
g1.zip as costcentre,
g1.contact as receiverattn,g1.phone1 as receiverph,
g1.address1,
g1.address2,
g1.city as address3
from Contact1 g1, contact2 g2
where g1.accountno =g2.accountno
and ufsale=current_date
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Author Comment

by:BernardGBailey
ID: 17085836
Hi sathyagiri,

>and ufsale=current_date

Local SQL thinks current_date is a field so it comes up "invalid fieldname"

Sorry,

Cheers
bernard
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17085848
I see I overlooked that. Ignore my post, please
0
 
LVL 14

Expert Comment

by:sathyagiri
ID: 17085861
Current_date is a function, so try current_date()
0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 17085898

For "Local SQL", the date function may be different (on Paradox, xBase and FoxPro it's DATE()).

If you want to code "generic" SQL, you would need to create a 'getdate()' function for each those DB's that have another name for this function.


0
 

Author Comment

by:BernardGBailey
ID: 17085933
Hi sathyagiri.

>and ufsale=current_date()

"capability not supported"

Cheers
Bernard
0
 

Author Comment

by:BernardGBailey
ID: 17085961
Hi MikeOM,

>and ufsale=DATE()

"Invalid use of keyword"

I already tried this, sorry.

Cheers
Bernard
0
 
LVL 14

Expert Comment

by:sathyagiri
ID: 17085992
What is the version of your LOCAL SQL?
0
 

Author Comment

by:BernardGBailey
ID: 17086147
Hi Sathyagiri,

I'm using database tour.

Cheers
bernard
0
 
LVL 14

Expert Comment

by:sathyagiri
ID: 17086217
Try using just DATE instead of DATE()
0
 

Author Comment

by:BernardGBailey
ID: 17086261
Hi Sathyagiri,

>and ufsale=DATE

"Invalid use of keyword
Token:DATE"

I guess this means there is another format of DATE we haven't arrived at yet.

Cheers
Bernard
0
 

Expert Comment

by:suhinrasheed
ID: 17088934
TRY and ufsale=sysdate

or

check if above is not wrking

ufsale=(select sysdate from dual)
0
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 2000 total points
ID: 17090546

It seems the Database Toour utlility is the culprit due to the fact that it will not recognize the DATE function for some of the databases.

Therefore you may want to use a parameter and supply the value at execution time:

SELECT (trim(both " " from key1)+"/0 "+ g1.company) as receivercompany,
             ulocname as locationname,
             g1.zip as costcentre,
             g1.contact as receiverattn,g1.phone1 as receiverph,
             g1.address1,
             g1.address2,
             g1.city as address3
     from Contact1 g1, contact2 g2
   where g1.accountno =g2.accountno
      and ufsale=:DATE

0
 

Author Comment

by:BernardGBailey
ID: 17105781
Hi MikeOM_DBA

Thnaks this will do in the meantime until I can get Vitaly to fix the issue.

Cheers
Bernard
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question