Best way for choosing datatype
What is the best way for choosing a datatype like if I have ID,Name,Mobile,Email,Phone,Address as the database fields.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rahul SinghPosted Dec 30, 2014, 4:11 AM
It all depends on the data you are going to store, as per the naming convention, I would suggest the following types:-
ID - INT
Name - NVARCHAR
Mobile - NVARCHAR
Email - NVARCHAR
Phone - INT \ NVARCHAR (again depends on data you are going to store)
Address - NVARCHAR
Riddhi ValechaPosted Dec 30, 2014, 2:09 AM
I would suggest,
ID - numeric(25,0) not null PK auto increment.
Name - varchar(60) not null
Mobile - numeric(18,0) allow nulls (in front-end, check that value is 10-digit mobile)
Email - varchar(100) allow null (eg - [email protected])
Phone - varchar(100) allow null (Eg- 020-2765432)
Address - varchar(max) (Eg- Street-21, New York).
----------
ID will be unique primary key - auto increment.
---------
See if this helps you out.
Manish Kumar ChoudharyPosted Dec 29, 2014, 11:12 PM
Hi Faiza Saher,
Actually it depends on your requirement which type of data you want to store in that field. First decide that and find the data type that is the best matched for your requirement.
Wim SturkenboomPosted Dec 29, 2014, 2:50 PM
Shweta LodhaPosted Dec 29, 2014, 1:31 PM