SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    binary datatype in MS SQL server

    hello,
    i set my datatype to binary. and used to convert function to insert data and i noticed it looked encrypted.

    I tried to use select statements and compare data and it worked fine.

    Please what is binary data type used for and is this right ?

    thanks
    aFrika

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    yes, it's encrypted using hexadecimal

    binary data is used for storing string of binary digits (0s and 1s)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot Rudy,
    so i guess it would be ok, to save rows as binary datatypes ?

    aFrika

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    not rows, columns

    and i would do it only if i had actual binary data

    i mean, you could theoretically store numbers as binary strings, but it makes a lot more sense to store them as numbers
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so what you are saying is that it would be wrong to store varchar in binary data using the convert function

    e.g to store sensistive data such as a username or password ?

    e.g insert into table_name (usr)
    values(convert(binary,usr))

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    binary strings are 4 times the size of char strings

    converting char strings to binary isn't wrong per se, just wasteful

    i think if you want to encrypt passwords you should use actual encryption

    binary isn't really encryption
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot.

    However do you know of any encryption functions in MS SQL that i could call in a SP ?

    or do i post this afresh ?

    thanks
    aFrika

  8. #8
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    do i know of any encryption functions? no, not personally

    however, twenty seconds after going to google, i found this -- SQL Security FAQ
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •