Can we use email or string as a primary key in database table?

Can we use email/string as a primary key in database table? and can pass in method of Asp.Net.


Asked by:- MuhammadFaizan
: 2290 At:- 8/2/2017 10:14:25 PM MVC C# string-as-primary-key

you can but creating the string as a primary key is not a good solution as it will slow down your database query execution 0
By : jaiprakash - at :- 9/15/2017 4:02:04 PM

1 Answers
profileImage Answered by:- vikas_jk

Yes, you can use string as primary key but it will slow down indexing so it is always better to use int as primary key.

If you have many users in database table I recommend you to use int as primary but if it is necessary you can use string and yes you can pass it to MVC ActionMethod.

please note: string must be unique, it cannot be email id , but it can be unique guid, like we see in default User table of mvc 5

At:- 8/3/2017 5:16:09 AM Updated at:- 8/3/2017 5:36:15 AM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use