Hi,
How can I insert an image.jpg file into a Sql 2008r2 image field? Using VFP9sp2 as the local client where the actual disk based image file is, I need to read the image file and save it into a variable for inclusion in a insert script that I create using textmerge. This script will be executed against a remote Sql server using the sqlexec command. It needs to be done purely in sql on the server side as there is only sql server running remotely. Is there a way to pass the variable that contains the image file through a converter (??2hex, ??2binary, ??2str, or some other converter so that it can be passed into the textmerge script, which actually supports text or similar? I'm trying to avoid using some other transport mechanism for delivery of the image file to the sql server, and the processing it on the server side, by including it directly in the sql insert statement. I'm also using a SQL Server native client connection string. Below is what I'm doing...
TEXT to m.lcSqlStr textmerge noshow
Insert Into [User]
(
[county_id],
[USER_ID],
[USER_NAME],
[photo],
[is_deleted]
)
VALUES
(
'<<pcCountyId>>',
'<<ui>>',
'<<un>>',
'<<data_from_image_file>>',
<<lnIsDeleted>>
)
EndText
lnSqlResults = SQLExec(ConnectionHandle, m.lcSqlStr)
Thanks, Stanley
How can I insert an image.jpg file into a Sql 2008r2 image field? Using VFP9sp2 as the local client where the actual disk based image file is, I need to read the image file and save it into a variable for inclusion in a insert script that I create using textmerge. This script will be executed against a remote Sql server using the sqlexec command. It needs to be done purely in sql on the server side as there is only sql server running remotely. Is there a way to pass the variable that contains the image file through a converter (??2hex, ??2binary, ??2str, or some other converter so that it can be passed into the textmerge script, which actually supports text or similar? I'm trying to avoid using some other transport mechanism for delivery of the image file to the sql server, and the processing it on the server side, by including it directly in the sql insert statement. I'm also using a SQL Server native client connection string. Below is what I'm doing...
TEXT to m.lcSqlStr textmerge noshow
Insert Into [User]
(
[county_id],
[USER_ID],
[USER_NAME],
[photo],
[is_deleted]
)
VALUES
(
'<<pcCountyId>>',
'<<ui>>',
'<<un>>',
'<<data_from_image_file>>',
<<lnIsDeleted>>
)
EndText
lnSqlResults = SQLExec(ConnectionHandle, m.lcSqlStr)
Thanks, Stanley