ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 26th, 2005, 02:39 PM
Caden Caden is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 272 Caden User rank is Private First Class (20 - 50 Reputation Level)Caden User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 7 h 8 m 8 sec
Reputation Power: 4
Date/Time in SQL

Hey again, i'm trying to get CF to put the date or date/time into the SQL 2003 date/time field.

So far i've tried a few things, I thought this was going to work...

insert into history (daytime) values ('#DateFormat(CreateODBCDate(now()), "DDMMYYYY")#')

my error was

Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

the SQL date/time field is 8 characters long, so, I don't know the best way to go about shoving a date/time into it in CF.

Thanks

Reply With Quote
  #2  
Old April 26th, 2005, 02:46 PM
Caden Caden is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 272 Caden User rank is Private First Class (20 - 50 Reputation Level)Caden User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 7 h 8 m 8 sec
Reputation Power: 4
Nevermind, I suppose I don't need to use the specified date/time field...if I change the field to varchar it works no problem. Although, it seems like a lame work around to me

Reply With Quote
  #3  
Old May 1st, 2005, 05:53 PM
cfcoyote cfcoyote is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 9 cfcoyote User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 14 m 52 sec
Reputation Power: 0
Question

Quote:
Originally Posted by Caden
Hey again, i'm trying to get CF to put the date or date/time into the SQL 2003 date/time field.

So far i've tried a few things, I thought this was going to work...

insert into history (daytime) values ('#DateFormat(CreateODBCDate(now()), "DDMMYYYY")#')

my error was

Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.


What is SQL 2003? What is your db?
I've used the CreateODBCDate() function sucessfully in inserts to MS SQL Server 2000 and MySQL with no issues as long as the colum data type is defined correctly.

Mark Holm

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Date/Time in SQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway