Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8715533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:52:08+00:00 2026-06-13T05:52:08+00:00

I want to insert a datetime value into a table (SQL Server) using the

  • 0

I want to insert a datetime value into a table (SQL Server) using the SQL query below

insert into table1(approvaldate)values(18-06-12 10:34:09 AM);

But I get this Error msg:

Incorrect syntax near ’10’.

I tried it with the quotes

insert into table1(approvaldate)values('18-06-12 10:34:09 AM');

I get this error message

Cannot convert varchar to datetime

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:52:09+00:00Added an answer on June 13, 2026 at 5:52 am

    You will want to use the YYYYMMDD for unambiguous date determination in SQL Server.

    insert into table1(approvaldate)values('20120618 10:34:09 AM');
    

    If you are married to the dd-mm-yy hh:mm:ss xm format, you will need to use CONVERT with the specific style.

    insert into table1 (approvaldate)
           values (convert(datetime,'18-06-12 10:34:09 PM',5));
    

    5 here is the style for Italian dates. Well, not just Italians, but that’s the culture it’s attributed to in Books Online.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to insert values into a SQL Server table, but every time I
I am using Python MySQLDB, and I want to insert this into DATETIME field
I am using an SQL query to insert data from an excel worksheet into
I have the sql query below. I want to take the results and insert
I want to insert a record into a MySQL database table from a formulaire.
I want to insert the following include tag into my webpage using JavaScript. <!--#include
hie all, i want to insert the data into the table only if the
I am using C# and SQL Server 2005. I want to store date and
I made iPad application in which, I want to insert record into database table,
I am trying to insert multiple records into SQL database. SQL table contains smalldatetime

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.