create defferent table for login

  • hi everybody

    i have table of user that is information about user and i put username and password in it.is it correct? or i must create different table for log in ?

    it is windows application with .net 3.5 and sql 2008 for small network

  • One table for User Details is fine. You just need to check if the data that the table houses is in Normalized Form.

    From what I understand you should have another column for "userID" which would act as a KEY/Unique Identifier for all unique combinations of "Username" and "password".

    This is because it may be possible that "Username" and "password" when considered alone may contain duplicates and the data would not be in Normalized form then.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • It's advisable to have passwords encrypted rather than storing them as it is...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • how can i do that?

  • These might help you to learn Encryption:

    SQL Server Encryption

    SQL SERVER – Introduction to SQL Server Encryption and Symmetric Key Encryption Tutorial with Script[/url]

    You could even do it from the client application as follows:

    Encrypt Password Field in SQL Server, Registry Information & Query String

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • vinu512 (4/24/2012)


    One table for User Details is fine. You just need to check if the data that the table houses is in Normalized Form.

    From what I understand you should have another column for "userID" which would act as a KEY/Unique Identifier for all unique combinations of "Username" and "password".

    This is because it may be possible that "Username" and "password" when considered alone may contain duplicates and the data would not be in Normalized form then.

    i mean how can i unique combinations for username and password?

  • Is it OK practice to store user details in a database table, only asking as I strictly use sql logins or windows auth?

    'Only he who wanders finds new paths'

  • vahid.arr (4/24/2012)


    vinu512 (4/24/2012)


    One table for User Details is fine. You just need to check if the data that the table houses is in Normalized Form.

    From what I understand you should have another column for "userID" which would act as a KEY/Unique Identifier for all unique combinations of "Username" and "password".

    This is because it may be possible that "Username" and "password" when considered alone may contain duplicates and the data would not be in Normalized form then.

    i mean how can i unique combinations for username and password?

    I am assuming that you already have a table which houses all the UserIDs and their respective passwords.

    Two or more users may have the same username or the same password. But, as a combination the UserID and the password would be unique for every User.

    Suppose, you have a table as:

    User_Details(Username, Password)

    In this case you will have identical data in the Username field or the password field or in both the fields. This is against the concept of NORMALIZATION.

    The table can be NORMALIZED by adding a UserID field to the above mentioned table:

    User_Details(UserID - Primary Key, Username, Password)

    In this case there will be a unique UserID for every distinct combination of the Username and password.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • david.alcock (4/24/2012)


    Is it OK practice to store user details in a database table, only asking as I strictly use sql logins or windows auth?

    I assume that you are talking about SQL Server Logins, but the OP is talking about the Logins in his Web Application.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • You can use encryption provided by SQL, where you can use keys, certificates etc for encryption. Another option is that application send password to database after encryption i.e. encryption is done from application side.

    regarding unique userid and password, it is generally a good practice to have unique users for an application , although passwords can be duplicate.

    vahid.arr (4/24/2012)


    how can i do that?

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • i have userid pk and i want also make username and password field uniqe.how can i do that?

  • vahid.arr (4/24/2012)


    i have userid pk and i want also make username and password field uniqe.how can i do that?

    You can create unique index (or unique constraint) on username. Why do you want to make the password unique?

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • I was indeed, even via a web app I have always created the sql logins accordingly but can see how they would be used in this way.

    'Only he who wanders finds new paths'

  • Eugene Elutin (4/24/2012)


    vahid.arr (4/24/2012)


    i have userid pk and i want also make username and password field uniqe.how can i do that?

    You can create unique index (or unique constraint) on username. Why do you want to make the password unique?

    Yes, Eugene is right. Username has to be unique(don't know what I was thinking when I thought it can be same for two users...too much workload I guess :sick:).

    So, you can create a Unique Index on Username. But, passwords can be same for many users. Why do you want to make the password unique?

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • vinu512 (4/24/2012)


    Eugene Elutin (4/24/2012)


    vahid.arr (4/24/2012)


    i have userid pk and i want also make username and password field uniqe.how can i do that?

    You can create unique index (or unique constraint) on username. Why do you want to make the password unique?

    Yes, Eugene is right. Username has to be unique(don't know what I was thinking when I thought it can be same for two users...too much workload I guess :sick:).

    So, you can create a Unique Index on Username. But, passwords can be same for many users. Why do you want to make the password unique?

    But how can you create a unique constraint if the column "Username" is non-nullable? I don't want any users without a username in my database and as far as i can see, unique only applies to nullable columns.

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic. Login to reply