473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Inserting date issue

I’ve finally made the jump from Access to SQL Express but I’m having some difficulty inserting a date using an asp/vbscript page.

I’ve trawled the web and persisted with trial and error and basically I’m down to 2 outcomes.

The first…

Formatting the date before insert, all combination of day month and year using / or - as a separator. The insert works but shows in the table as either 01/01/1900 or some other crazy combination.

The second…

Formatting the date as yyyymmdd as recommended up and down the web produces this error

Microsoft OLE DB Provider for ODBC Drivers (0x80040E57)
[Microsoft][SQL Native Client][SQL Server]Arithmetic overflow error converting expression to data type datetime.

I’m very new to SQL so I could be wrong but I’m starting to think this is a SQL configuration issue.

The SQL column is set to datetime
The user language (user defined in the connection string) is set to British English although I’ve tried plain English too.

Any ideas welcome.
Aug 16 '07 #1
3 1261
Have you tried this?

Expand|Select|Wrap|Line Numbers
  1. Convert(datetime,'YYYY-MM-DD')
Aug 16 '07 #2
Can that be used in an asp/vbscript page?

Sorry I should have made it clear I'm doing this via an asp page
Aug 16 '07 #3
Sure, just put that into your SQL string with the rest of the SQL statement.

So if I had an ASP variable called strVar1 containing a date string of '2007-08-16' to insert that into sql I would do the following.
Expand|Select|Wrap|Line Numbers
  1. SQL = "Insert into DateField Select convert(datetime," & strVar1 & ")"
Aug 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
2
by: avinash | last post by:
hello myself avinash i am developing on application having vb 6 as front end and sql server 7 as back end. when i use insert query to insert data in table then the date value of that query is...
3
by: J. Muenchbourg | last post by:
while inserting new records into SQL, i'm using the folloinwg sqlstatement> Dim MySQL as string = "Insert into roster (pname, pnotes, thedate) values (@pname, @pnotes, @thedate)" the sql...
2
by: Rick | last post by:
How do I go about doing this? Basically I have a field where the user inputs a doctors name, a field where the user inputs the doctors bio, and then a picturebox where they select an image from...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
6
by: fniles | last post by:
I am using VB.NET 2003 and SQL Server 2000. I have a table with a datetime column type. When inserting into the table for that column, I set it to Date.Now.ToString("T") , which is something like...
13
by: imnewtoaccess | last post by:
Hi, I am getting errors while inserting records in one table from another. These are the structures of two tables : file51tm_new RecordType Text
1
by: microjack | last post by:
I’ve finally made the jump from Access to SQL Express but I’m having some difficulty inserting a date using an asp/vbscript page. I’ve trawled the web and persisted with trial and error and...
2
by: Question123 | last post by:
Hi i have one database table Table1.which contains almost 20000000 recordes. record to this table are inserted through storedprocedure. storedprocedure takes parameter as "value", Beginningdate,...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.