Binary data may be images, sounds, or any other data. If we can express these binary values as constants, we can directly use the transcat-SQL statement to insert and update the data in the data table.
In fact, transcat-SQL has provided us with a method, that is, the binary constant format. This format starts with "0x", followed by several hexadecimal numbers. Each byte is represented by two hexadecimal numbers. Therefore, you can convert the image sound data to this binary constant format and then use it in the insert or update statement.
However, such binary constants will be very long. In this way, SQL statements are difficult to look at, and there are still problems in the editor with limited line length.
So there is no way to fold binary constants?
Unfortunately, I checked the online help of transact-SQL and searched the network without any answer.
Is there really no way?
A path can always be taken after someone passes it. Maybe our predecessors have traveled before, but they do not know. Even, the road was there, and you dare not go?
As a result, the adventure begins:
I forcibly break the long binary constant, execute it, and make an error...
Add "_" and VB line breaks in the previous line. An error occurred...
An error occurred while changing to the line symbol of the "/N", C, C ++ string...
Error Caused by quotation marks...
An error occurred while changing double quotation marks...
..., Error...
..., Error...
..., Error...
Add "/" to the previous line. Success!
I can't believe it. Try again!
After a little surprise, I immediately kept calm: Is the inserted Data correct?
Now, write a program for verification, which is completely correct!
The original "/" is a line break of a binary constant, and the path is there!
Note: In insert and update statements, up to 8000 bytes of data can be updated with binary constants. If necessary, use the writetext statement or updatetext statement to process larger data, and perform multipart processing.
Li Zhan. Shenzhen 2004-10-14