Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mani6961
Starting Member
10 Posts |
Posted - 2013-08-20 : 10:47:22
|
Hi all, I am having trouble inserting some binary data into a table. It has a column: varbinary(max) and this insert statement is not working: The binary is very long, but I would have assumed that varbinary(max) could store it:exec sp_executesql N'insert into Test(ImageCol) values @IMAGE',N'@IMAGE varbinary(max)',@IMAGE=0xFFD8FF....680680680680680680680FFD9It keeps reporting an error suggesting incorrect syntax, and that "the identifier that starts with 'A01......' is too long. It's as though my syntax is incorrect.I've also triedinsert into Test(ImageCol) values 0xFFD8FF....680680680680680680680FFD9 and it's the same error (which I expected)I hope that it is something small, or perhaps it is just sheer ignorance. Thanks for any help. -Ty |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-08-20 : 10:52:46
|
I am not familiar with that error message about the identifier being too long, but regardless, your insert statement requires a pair of bracketsinsert into Test(ImageCol) values (0xFFD8FF....680680680680680680680FFD9) |
|
|
mani6961
Starting Member
10 Posts |
Posted - 2013-08-20 : 11:03:12
|
Makes sense about the brackets, but same error with\without them.-Ty |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-08-20 : 11:16:01
|
How long is your binary? I tried to insert a binary value that is 1,134,300 long, and it succeeded. Also, I don't see any identifier that starts with A01 in anything you posted. Look for A01 in your query and see what goes on there. |
|
|
mani6961
Starting Member
10 Posts |
Posted - 2013-08-20 : 11:28:14
|
It is around 133,000 characters, so it's rather large to post the entire string. The A01 is there, but it seems like there is an issue with the syntax on the 2nd line. So for your insert you just have insert into YourTable(YourImage) value (0xF....F) where the binary isover 1 million characters long?-Ty |
|
|
mani6961
Starting Member
10 Posts |
Posted - 2013-08-20 : 11:29:23
|
I put everything on the same line and it worked (with the brackets)Thanks guys.-Ty |
|
|
|
|
|
|
|