DECLARE
@IMG_PATH VARCHAR(MAX),
@TIMESTAMP VARCHAR(MAX),
@ObjectToken INT,
@FILENAME varbinary(MAX),---new variable here
@hr int
SELECT @IMG_PATH = filnm
,@FILENAME = filedata ---column selected here
FROM syver01t a
where a.filnm = 'apf01.pbd'
SET @TIMESTAMP = 'd:\sign\'+@IMG_PATH
select @IMG_PATH,@TIMESTAMP,@FILENAME
EXEC @hr = sp_OACreate 'ADODB.Stream', @ObjectToken OUTPUT
select @hr
EXEC @hr = sp_OASetProperty @ObjectToken, 'Type', 1
select @hr
EXEC @hr = sp_OAMethod @ObjectToken, 'Open'
select @hr
EXEC @hr = sp_OAMethod @ObjectToken, 'Write', NULL, @FILENAME --new variable here
select @hr
EXEC @hr =sp_OAMethod @ObjectToken, 'SaveToFile', NULL, @TIMESTAMP, 2
select @hr
EXEC @hr =sp_OAMethod @ObjectToken, 'Close'
select @hr
EXEC @hr =sp_OADestroy @ObjectToken
select @hr
'SQL' 카테고리의 다른 글
DB 복원,로그 정리관련 명령어 (0) | 2014.03.01 |
---|---|
Send_Mail (0) | 2012.06.21 |
SQL Backup Schedule root : NAS (0) | 2012.05.22 |
해당 SPID가 수행하고있는 쿼리보기 (0) | 2012.05.09 |
암호 만료정책 설정 (0) | 2012.03.28 |