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" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to