View Single Post
  #6  
Old March 11th, 2005, 04:59 PM
George Nicholson
external usenet poster
 
Posts: n/a
Default

Jamie:

Happy Friday. Your turn for review: :-)

CREATE TABLE TEST ( text_col VARCHAR(10), int_col INTEGER)
creates a Long Integer field, so, no,
INSERT INTO TEST (text_col, int_col) VALUES (1000000,1000000)
doesn't raise any errors for me either. No reason for it to.
INSERT INTO TEST (text_col, int_col) VALUES ('1000000','1000000')
doesn't raise an error either. I assume that since the value intended for
the numeric field can be converted into a number, Jet just does it, since
the following does raise a type conversion error on the 2nd value:
INSERT INTO TEST (text_col, int_col) VALUES ('1000000','ABC') (wrong type
of value)

However,
CREATE TABLE TEST ( text_col VARCHAR(10), int_col SMALLINT)
INSERT INTO TEST (text_col, int_col) VALUES (123456789012,1000000)
truncuates the 1st value to 10 characters and raises a type conversion error
for the 2nd value (it is too big a number, which means it's the wrong type).
So does
INSERT INTO TEST (text_col, int_col) VALUES ('123456789012','1000000')
but the error is based on numeric field size, not any text vs. numeric
conflict.

INSERT INTO TEST (text_col, int_col) VALUES ('1234567890',32767) or
INSERT INTO TEST (text_col, int_col) VALUES ('1234567890',32767) or
INSERT INTO TEST (text_col, int_col) VALUES ('1234567890','32767')
All run without errors and append the specified values correctly (the 2nd
value being converted to a number in the last example)

Your point about string length (if you were trying to make one) is taken:
trying to append 20 characters into a text field with a length of 10 doesn't
raise an error, it just appends the 1st 10 characters. But that isn't what
you were trying to call me on :-)

--
George Nicholson

Remove 'Junk' from return address.

"onedaywhen" wrote in message
oups.com...

George Nicholson wrote:
Type conversion failure (which you aren't getting at the moment)

would be
trying to put text into a numerical field, etc., (but not vice

versa). Or
trying to put 1,000,000 into a field defined as Integer (max value of


32,767).


I think you should review this whole paragraph e.g.

CREATE TABLE TEST (
text_col VARCHAR(10),
int_col INTEGER)
;
INSERT INTO TEST (text_col, int_col)
VALUES (1000000,1000000)
;
INSERT INTO TEST (text_col, int_col)
VALUES ('1000000','1000000')
;

The above generates no errors for me.

Jamie.

--