-
May 9th, 2022, 12:22 AM
#1
Thread Starter
Member
Save Image to Database TSQL issue
Please i need help with this line, been giving headache for hours.
Code:
insert into tblPicture1 (AcctNo, MCard,FileName) SELECT '900901', * FROM Openrowset( Bulk 'C:\MyFiles\Media\Photo14061004777.JPG', Single_Blob) as img,'ChurchPhoto'
Error i get is Incorrect syntax near 'ChurchPhoto'
Please help.
The table tblPicture1 has the following structure:
[AcctNo] [nvarchar](50) NULL,
[MCard] [image] NULL,
[FileName] [nvarchar](50) NULL
Thanks.
-
May 9th, 2022, 01:32 AM
#2
Re: Save Image to Database TSQL issue
Not having worked with TSQL, my Bet would be
Code:
insert into tblPicture1 (AcctNo, MCard,FileName)
SELECT '900901', img.*,'ChurchPhoto' FROM Openrowset( Bulk 'C:\MyFiles\Media\Photo14061004777.JPG', Single_Blob) as img
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
May 9th, 2022, 03:34 AM
#3
Thread Starter
Member
Re: Save Image to Database TSQL issue
Originally Posted by Zvoni
Not having worked with TSQL, my Bet would be
Code:
insert into tblPicture1 (AcctNo, MCard,FileName)
SELECT '900901', img.*,'ChurchPhoto' FROM Openrowset( Bulk 'C:\MyFiles\Media\Photo14061004777.JPG', Single_Blob) as img
Thank you so much
-
May 9th, 2022, 03:42 AM
#4
Re: Save Image to Database TSQL issue
Btw, the name of the single column in OPENROWSET resultset is "BulkColumn" if you want to be explicit instead of using img.*
cheers,
</wqw>
-
May 9th, 2022, 03:50 AM
#5
Re: Save Image to Database TSQL issue
Originally Posted by wqweto
Btw, the name of the single column in OPENROWSET resultset is "BulkColumn" if you want to be explicit instead of using img.*
cheers,
</wqw>
Cheers wqweto.
Since i've never worked with MS-SQL-Server (and thusly with TSQL), i didn't know that, so my "img.* " was kinda of "be on the safe side" (as safe as it can be)
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|