Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What happens when you try...

Status
Not open for further replies.

AlaskanDad

Programmer
Mar 1, 2002
188
US
... to pass a '1' into an integer field using an Insert statement?

I can't access my database right now to try it.

Does it have to be sent as 1 to properly insert?

Thanks,
Rob
 
Yes something like this:

INSERT INTO yourtablename(yourfield) VALUES(1)

-VJ
 
ASLO...

if you are trying to pass a variable that has value 1 from ASP then

you can try

INSERT INTO yourtablename(yourfield) VALUES('"&yourvariablename&"')

-VJ
 
ALSO...

if you are trying to pass a variable that has value 1 from ASP then

you can try

INSERT INTO yourtablename(yourfield) VALUES('"&yourvariablename&"')

-VJ
 
Your Insert statement is exactly what I'd like to do. However, I'm concerned that if I try this:

INSERT INTO yourtablename(yourfield) VALUES('"&yourvariablename&"')

and yourfield is datatype integer, it might produce an error.

Will there be an error if I try and put '1' (not 1 without the apostrophes) into an integer field?
 
No there wont be any error if you put '1'

both the below queries will work

SQL1= INSERT INTO yourtablename(yourfield) VALUES('1')

SQL2= INSERT INTO yourtablename(yourfield) VALUES(1)

ASP versions are as follows

SQL1= INSERT INTO yourtablename(yourfield) VALUES('"&yourvariablename&"')
SQL2= INSERT INTO yourtablename(yourfield) VALUES("&yourvariablename&")

but SQL2 should be used if you are sure your field is an integer

-VJ


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top