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 |
|
McGurk
Starting Member
21 Posts |
Posted - 2010-02-03 : 10:44:31
|
| I need to store a PDF in my existing db table record. What statement can I use to do this?McGurkAll that is gold does not glitter, not all those who wander are lost... JRR Tolkien |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-02-03 : 11:12:27
|
| INSERT statement. It's up to your application to read and write the binary values for it. This article should help: http://msdn.microsoft.com/en-us/library/a1904w6t(VS.80).aspx |
 |
|
|
McGurk
Starting Member
21 Posts |
Posted - 2010-02-03 : 14:30:26
|
| Thanks for the reply. Not always, in this case, I need to enter it into the db using tsql.McGurkAll that is gold does not glitter, not all those who wander are lost... JRR Tolkien |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-02-03 : 14:53:27
|
| yes, you still use T-SQL INSERT statement. What I mean is that the app needs to decipher it and put it back as a pdf when you read it out |
 |
|
|
McGurk
Starting Member
21 Posts |
Posted - 2010-02-03 : 17:39:42
|
| Sorry, I misunderstood. Yes, the app does do that.For anyone looking for a similar solution, below is the TSQL statement:USE MyDBName;GOUPDATE MyTableNameSET MyColumnName = (SELECT *FROM OPENROWSET(BULK 'C:\MyFile\MyImage.pdf', SINGLE_BLOB) AS MyColumnName)WHERE PrimaryKeyId = 1002;McGurkAll that is gold does not glitter, not all those who wander are lost... JRR Tolkien |
 |
|
|
|
|
|