tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Eric Miller" <jemil...@uchicago.edu>
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'})

Jon

----- Original Message -----
From: "Uma Maheswar" <uma@globalleafs.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Monday, February 11, 2002 12:00 PM
Subject: Inserting DATE into SQL server


Hi,
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.

Uma



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message