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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error is 296: "The conversion of char data type to smalldatetime datat

Status
Not open for further replies.

GaryInUK

Programmer
Joined
Sep 13, 2001
Messages
2
Location
GB
Hi,

Select ActiveCharges.ID, ChargeTypes.Name, ActiveCharges.Start, ActiveCharges.[End], ActiveCharges.Amount from ActiveCharges
INNER JOIN ChargeTypes ON ActiveCharges.ItemID = ChargeTypes.ID
Where ActiveCharges.ProviderNo = 1 AND [End] = CAST('2078/12/31 00:00:00' as smalldatetime) Order By ItemID

Simple - works on my SQL Query Analyser, but doesn't work on my mate's.

Am I missing something???

The error is 296: "The conversion of char data type to smalldatetime datatype resulted in an out-of-range smalldatetime value"

This is causing the prob I believe
[End] = CAST('2078/12/31 00:00:00' as smalldatetime)

but which settings must I check to make sure it works.

Cheers,

Gary
 
I figured it out. Cunningly the SQL Logins had been incorrectly set up by the DBA.

One was "British English" the other was "English". Consequently the day and month needed to be one way for one person and the other way for the other person
 
Hi Gary,
I think you should pass the string for CAST function, in the following format.

yyyy-mm-dd hh:mm:ss
e.g.
'2078-12-31 00:00:00'

Hope this helps.
Mukund.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top