Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

import from odbc where date = getdate() dont work

Status
Not open for further replies.

sixtoedsloth

IS-IT--Management
Jan 1, 2002
118
GB
HI,

Please can you tell me how to do this :-

DTS package
input : connx ODBC for powerflex
output : sql server 2000

source sql statement:-

select * from scanbox where scanned_date = convert(char(10),getdate(),10)

this wont work! how do i restrict the select based on
the date field?

Regards,


Russ

 
Is scanned_date a DateTime data type?

If so, then try ...

select *
from scanbox
where convert(char(10),scanned_date,10) =
convert(char(10),getdate(),10)


Thanks

J. Kusch
 
The format type (10) you chose for the convert does not have ten characters, only 8 (no centuries). It's format is mm-dd-yy

Hope this helps.

Sometimes the grass is greener on the other side because there is more manure there - original.
 
Johnherman is correct.

As you will see in my example above though, I have taken that into account and formatted the scanned_date to use a "Style" of 10 so that the comparisons are based on the same formatting rule.

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top