Can I insert numbers into varchar data type | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can I insert numbers into varchar data type

8th Jul 2016, 7:30 AM
Mohan pochampalle
Mohan pochampalle - avatar
11 Answers
+ 1
Yes you can
8th Jul 2016, 9:12 AM
Manu
+ 1
thank you to all for help
8th Jul 2016, 2:19 PM
Mohan pochampalle
Mohan pochampalle - avatar
+ 1
exe: while($myvar=$myvar1->fetch()){echo (double)$myvar['price'];} where price is à varchar column in you database containing thé pruce
16th Jul 2016, 2:27 PM
LISANGOLA BONDJALI CHRISTIAN
LISANGOLA BONDJALI CHRISTIAN - avatar
+ 1
Yes you can, but you will not be able to perform any math towards them because they are considered words. In most cases an address has numbers in a varchar variable.
29th Jul 2016, 5:40 AM
nk361
nk361 - avatar
0
yes by writing nvarchar
8th Jul 2016, 7:55 AM
niki
0
who know char's mean
8th Jul 2016, 4:46 PM
liu
0
Yes you can, but it will turn them into strings, so you cannot do math on them without converting them into integers or floats.
8th Jul 2016, 8:30 PM
Darwin
0
yes, you will able to insert any character, number, special character too ..etc
11th Jul 2016, 1:39 PM
SOLEYMAN
SOLEYMAN - avatar
0
writer characters like Alphabet
16th Jul 2016, 11:26 AM
Adeosun Abiola Dickson
Adeosun Abiola Dickson - avatar
0
yes,you can but if you want to use them as numbers un a program you must do a cast according to à Numerical type of each varchar record from your table with thé correspondant column
16th Jul 2016, 2:23 PM
LISANGOLA BONDJALI CHRISTIAN
LISANGOLA BONDJALI CHRISTIAN - avatar
0
thank you to all
16th Jul 2016, 2:26 PM
Mohan pochampalle
Mohan pochampalle - avatar