CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2006
    Location
    Wisconsin
    Posts
    7

    Question Using MS SQL Binary Data Type

    I want to use varBinary to store some values but I'm a little confused on choosing the correct size for the data type. I'm not use to dealing with binary.

    I think I understand that Binary is stored as bytes...? If, for example, I have a string that is going to be a maximum of 30 characters long, I would use the nVarChar data type with a size of 30. So if I am storing a password that is no more then 30 characters long (from an array), and saving it as varBinary, would I choose 30 as the size for the binary data type?

    Also, I'm looking for a very good buffer to read binary data from the database, are there any excellent examples of a buffer I could use when reading the binary data from the database? Should I also use the buffer when saving data to the database?

    Thanks in advance.
    Last edited by Shup; June 13th, 2006 at 03:58 PM.
    For replies, I am using:
    MS SQL 2000, VS .Net 2003, Visual C++ 6.0, XP Pro

  2. #2
    Join Date
    Mar 2004
    Posts
    28

    Re: Using MS SQL Binary Data Type

    Have you found your answer to this, Shup?

    I have a similar need of inserting/selecting binary data from a SQL Server 2000 table.

    I'd appreciate any insight you may have come across.

    jim

  3. #3
    Join Date
    Nov 2004
    Location
    Poland
    Posts
    1,355

    Re: Using MS SQL Binary Data Type

    Post your requirements for taht data. I don't know what a problem is. I'm using binary data in SQL2000 with no problem at all. If U want to store passwords in db then I think it should be avoided. If U cannot live without it U can use ittaking into account difference between UNICODE string length and number of bytes it takes to store it (and if it is a password than is should be hashed). So what your problem really is? What programming language U prefer to use?

    Best regards,
    Krzemo.

  4. #4
    Join Date
    Mar 2004
    Posts
    28

    Re: Using MS SQL Binary Data Type

    Krzemo-

    Thank you for your interest in my problem.

    I have created a new thread with the details entitled:

    "Multiple-step OLE DB ... errors" on ADO PutValue

    I welcome any thoughts you may have about my issue, which has me completely blocked.

    Regards,

    jim

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured