Question : varchar - varbinary

Hello experts
Because i'm a liitle confused with all the datatypes i want to ask you what are the differences between these two datatypes(varbinary-varchar).
I want to store text data in a table column and use a searchfield in a form to compare the entered values with the data in the table column.
What is the datatype i have to use?

Answer : varchar - varbinary

Char: (1 byte per Character. Maximum 8000 Characters)

(The char data type is a fixed - length data type used to store character data. The number of possible characters is between 1 and 8000. The possible combination of characters in a char data type are 256. The characters that are represented depend on what language, or collation, is defined. English, for example, is actually defined with a Latin collation. The Latin collation provides support for all English and western European characters.)

varchar:(1 byte per character. Up to 2GB characters.)

(The varchar data type is identical to the char data type, but with a variable length. If a column is defined as char(8) , it will consume 8 bytes of storage even if only three characters are placed in it. A varchar column consumes only the space it needs. Typically, char data types are more efficient when it comes to
processing and varchar data types are more efficientfor storage. The rule of thumb is to use char if the data will always be close to the defined length, but use varchar if it will vary widely. For example, a city name would be stored with varchar(167) if you wanted to allow for the longest city name in the world, which is Krung thep mahanakhon bovorn ratanakosin mahintharayutthaya mahadilok pop noparatratchathani burirom udomratchanivetmahasathan amornpiman avatarnsathit sakkathattiyavisnukarmprasit (the poetic
name of Bangkok, Thailand). Use char for data that is always the same. For example, you could use char(12) to store a domestic phone number in the United States: (123)456 - 7890. The 8000 - byte limitation can be exceeded
by specifying the (MAX) option (varchar(MAX)) , which allows for the storage of 2,147,483,647 characters at the cost of up to 2GB storage space.)

binary: (1 – 8000 bytes)
(Fixed - length binary data. Length is fixed when created between 1 and 8000 bytes. For example, binary(5000)  specifies the reserving of 5000 bytes of storage to accommodate up to 5000 bytes of binary data.)

varbinary:(Up to 2,147,483,647 bytes)

(Variable - length binary data type identical to the binary data type, with the exception of consuming only the amount of storage that is necessary to hold
the data. Using the (MAX) option allows for the storage of up to 2GB of binary data. However, only 1 through 8000 or MAX can be specified as storage
options.)

Thanks
Random Solutions  
 
programming4us programming4us