Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

LInked server to Oracle database fail data conversion Expand / Collapse
Author
Message
Posted Friday, November 30, 2012 1:15 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, December 30, 2013 6:50 AM
Points: 196, Visits: 402
On a SQL Server instance I have a linked server to an Oracle database. If I run query using a date it is ok from SSMS master database. But if I try to run it in a user database the date conversion fails. Is this the way it is, I have to use master? Or can I fix the conversion?
Query has:
... where Linkname..databasename.datefield = '2011-01-01 00:00:00.0000000'
It runs fine in master but when run in a user database I get error:
"Conversion failed when converting date and/or time from character string"
Thanks.
Post #1391532
Posted Friday, November 30, 2012 4:39 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 11:50 PM
Points: 1,356, Visits: 5,666
make sure you make it a date-datatype instead of a string using cast or convert
Comparing dates with strings is usually a recipe for disaster
Post #1391589
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse