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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert, Update correct way

Status
Not open for further replies.

ralphiooo

Programmer
Oct 23, 2005
64
GB
Insert, update into mysql database. Hi, I've recently been programming in asp.net and one thing i noticed on the insert and update statements into the mssql database it was common practice to remove the ' around the variable when inserting a number eg:

insert into table (field_string, field_integer) values ('$string', $integer)

I was wondering whether I should be doing this, also I was wondering whether enum is a number or a string.

Appreciate any help. Cheers
 
MySQL will automagically convert the string value to a number if it has to. But I remember a thread once about two years ago where someone had a performance issue sending lots of numeric values inside quotes.

Generally, I do not put quotes around numeric values. If for no other reason than it helps me keep the strings and numbers in by queries straight.


I send enum values inside quotes.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Cheers couldn't have put it much clearer. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top