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.
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
Re: Save Image to Database TSQL issue
Quote:
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
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>
Re: Save Image to Database TSQL issue
Quote:
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)