tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Eric Miller" <>
Subject Re: Inserting DATE into SQL server
Date Tue, 12 Feb 2002 01:08:33 GMT

Unless your table only has one column, you need to specify which column you
are setting the value for in your INSERT statement.

You should also use the JDBC escape sequence for a date as well that way it
is DBMS independent.

INSERT INTO table1 (column1) VALUES ({d 'yyyy-mm-dd'})


----- Original Message -----
From: "Uma Maheswar" <>
To: "Tomcat Users List" <>
Sent: Monday, February 11, 2002 12:00 PM
Subject: Inserting DATE into SQL server

I wanted to insert date values into the database in SQL Server.The data

type I used in SQL server is "DATETIME". I have <select> tags used in

HTML page to ask the user select the date. I am doing it in this way

month = request.getParameter("month");
date = request.getParameter("date");
year = request.getParameter("year");

totdate = month+"/"+date+"/"+year;

insert into test values('"+totdate+"');

I get error in Tomcat saying that the data type or the number of

columns are mismatched. How do I insert date into SQL server.

Thanks for any help.


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message