Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 25th, 2005, 03:33 PM
Authorized User
Join Date: Nov 2005
Location: , , .
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default Converting from character to smalldatetime

i have a problem in converting character input into datetime or smalldatetime input.the problem is i have an asp page with javascript that sends, in query,the time in characters to the database on SQL Server 2000, but this is causing an error:

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value...
although i used the convert function but it didn't work(same error),
so i cannot insert any row into database. What should i do? i need help badly on this one!:(

Reply With Quote
  #2 (permalink)  
Old November 25th, 2005, 03:41 PM
Authorized User
Join Date: Sep 2005
Location: , , .
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts

Is the date a valid date, are you doing validation?
How are you passing the date in, can you give an example?
Look at the range below
Date and time data from January 1, 1753 through December 31, 9999

Date and time data from January 1, 1900, through June 6, 2079

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" -- http://sqlservercode.blogspot.com/
Reply With Quote
  #3 (permalink)  
Old November 26th, 2005, 06:01 AM
Authorized User
Join Date: Nov 2005
Location: , , .
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray

ok, i am using the following in the javascript,
var cdate= new Date();//gets me the current date
var sql="Insert into tablex values ("+cdate+")";
if i use
var sql="Insert into tablex values ('"+cdate+"')";
i get the error of conversion of characters to date time,if i use the first one a get something about variables and constants,and rejects the day part ("Thu,Fri,...."). i will try some more validation and get back to you with the results, but hope you assist me meanwhile. 10x lot

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error converting datetime from character st vinod_yadav1919 SQL Server 2000 2 September 10th, 2010 10:11 AM
Converting to character from date string denver Access VBA 7 June 9th, 2006 07:30 AM
Converting an ASCII character to binary? skyraider Visual Basic 2005 Basics 0 May 7th, 2006 08:20 PM
Converting Unicode to Character RobinR Classic ASP Basics 4 August 6th, 2004 11:40 AM

All times are GMT -4. The time now is 04:07 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.