CREATE TABLE [cmp].[tblCMPEmailAttachements](
[AttachmentID] [int] IDENTITY(1,1) NOT NULL,
[EmailID] [int] NOT NULL,
[FileName] [nvarchar](50) NULL,
[CreatedDate] [datetime] NULL,
[FileBody] [varbinary](max) NULL
) ON [PRIMARY]
Declare @attID int
Insert into cmp.tblCMPEmailAttachements (EmailID,FileName,CreatedDate) values (1,'1.gif',GETDATE())
SET @attID = SCOPE_IDENTITY();
update cmp.tblCMPEmailAttachements set
[FileBody] = (SELECT * FROM OPENROWSET(BULK 'C:\1.gif', SINGLE_BLOB)AS [FileBody] ) WHERE AttachmentID=@attID
more...
No comments:
Post a Comment