Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binary or blob data type
Message
 
 
To
09/04/2019 11:41:45
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01668007
Message ID:
01668017
Views:
37
>>>>Hi,
>>>>
>>>>I would like to experiment with binary data. I read in the VFP help that for binary data you have to use Blob type field.
>>>>I created a test cursor with B type field. But, the following produces error:
>>>>
>>>>CREATE CURSOR binerytest (testfld b)
>>>>INSERT INTO binerytest (testfld) VALUES ("123")
>>>>
>>>>
>>>>How do you store a string in this field?
>>>Hi Dmitry,
>>>
>>>CREATE CURSOR binerytest (testfld W) && or Q(254)
>>>INSERT INTO binerytest (testfld) VALUES (0h313233)
>>>INSERT INTO binerytest (testfld) VALUES (CAST("123" AS VARBINARY(3)))
>>>
>>>
>>>MartinaJ
>>
>>Hi Martina,
>>First, thank you for your help.
>>I am looking at the Help page of VFP and can't seem to figure out what type is "W" or "Q". Could you please explain?
>>
>>Update: Just found in help that Q stands for Varbinary but nothing about W.
>>
>>Update 2:. Do I understand that the number parameter in the VARBINARY(N) should be equal to the number of characters in the string? This is why you wrote (above) VARBINARY(3)?
>
>Dmitry
>
>You can find about all the various types and their shortcuts in the help on CREATE TABLE or CREATE CURSOR. To create a blob field, you must use W or Blob (as you can see in the list, B is the shortcut for Double).
>
>Therefore, an alternative to the second form that Martina suggested would be to CAST("123" AS Blob) or CAST("123" AS W), with no need to worry about string lengths.

Antonio,
Thank you very much. I will try both cases. I am just wondering what choice is better for me when mapping the VFP cursor to the SQL Server table column type varbinary(250) via cursor adapter.
"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
Next
Reply
Map
View

Click here to load this message in the networking platform