Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binary or blob data type
Message
 
 
To
09/04/2019 14:41:21
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01668007
Message ID:
01668022
Views:
35
Antonio,
Thank you very much!!

>Dmitry, this time I'll post my reply inline.
>
>>1. If I check the LEN() of the VARBINARY field, it returns the number of bytes, not the number of characters this value would be cast to. Correct?
>>Example:
>>
>>cTest = "1234567890"
>>bTest = cast( cTest as varbinary(250))
>>? len(bTest)      && shows 10 = number of bytes.
>>? bTest             && much longer than 10.  That is, this is the actual length of the value in the field
>>
>
>Do not get confused by the representation of the data. What you see in the second line is the same as "0h" + STRCONV("1234567890", 15), that is, the hexadecimal representation of the ANSI codes for characters "1", "2", "3", and so on, preceded by the "0h" prefix that signals "this is a hexadecimal encoded binary string".
>
>Binary strings are quite similar to regular ones, not considering their representation. You also have the max size limit of 254 bytes for a binary string literal, and you can use binary and regular strings interchangeably (I think always, but may be proven wrong on this...).
>
>For instance, SUBSTR(0h31323334353637383930, 2, 1) returns 0h32 (yes, that's a single byte). You can even concatenate regular and binary strings, but attention must be paid to the order of operands:
>
>
>? 0h31323334353637383930 + "Dmitry" 
>? "Dmitry"  + 0h31323334353637383930
>
>
>will result in
>
>
>0h31323334353637383930446D69747279
>Dmitry1234567890
>
>
>being displayed (remember, that's the representation, both values are exactly the same).
>
>>
>>2. In SQL Server table I can make a column to be BINARY(250) (instead of VARBINARY(250)) but not in VFP.
>>VFP has only VARBINARY and not BINARY type. Correct?
>
>Yes, although if you mark a character field as being NOCPTRANS, as Martina told you, you'll get a BINARY() equivalent. When retrieving data from the SQL Server, BINARY(250) will come down as Varbinary(250) (its LEN() always 250). If BINARY() length exceeds 254, it will turn into a Blob (always of a fixed sixe).
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform