I know that is not valid sql, but it was the jist of what I was inserting.

I got it figured out.  I am using Java to create this sql statement and
there is a decimal formatting object in java, so I used that to format the
variable that I am inserting and bingo, fixed.

Thanks for you gray matter time

Dean-O
aka Java Dude, SQL Geek in training


-----Original Message-----
From: Roger Baklund [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 6:16 AM
To: MySQL (E-mail) (E-mail)
Cc: Rochester, Dean
Subject: RE: How do you set the char format for a column in Mysql table


* Rochester, Dean
> I have a Mysql table with a char(2) column, name is Dependents.
> I want the value that I insert to always be to places.  I have tried
>
> Insert into Table1 Dependents values '02';
>
> but it inserts  2 in the Dependents column

Really? It is not valid SQL...

mysql> create table Dependents (test char(2));
Query OK, 0 rows affected (0.09 sec)

mysql> Insert into Table1 Dependents values '02';
ERROR 1064: You have an error in your SQL syntax near 'Dependents values
'02'' at line 1
mysql> Insert into Dependents values ('02');
Query OK, 1 row affected (0.03 sec)

mysql> select * from Dependents;
+------+
| test |
+------+
| 02   |
+------+
1 row in set (0.02 sec)

> How do I make it insert  02?

I don't know what you did wrong... did you use quotes? You must use quotes,
or it will be interpreted as a number, and 02 will be 'converted' to 2...

--
Roger

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to