{
if object_id('test', 'U') is not null
drop table test
go
create table test(cid int identity, ctext text, cimage image)
insert test(ctext, cimage) select '', 0x0
}
{
C:/>textcopy /S. /Usa /P /DMyDB /Ttest /Cctext /W"where cid = 1" /Fa.txt /I /Z
TEXTCOPY Version 1.0
DB-Library version 8.00.194
debug: Final parameters:
debug: Server: .
debug: Login: sa
debug: Password:
debug: Database: MyDB
debug: Table: test
debug: Column: ctext
debug: Where clause: where cid = 1
debug: File: a.txt
debug: Direction: Into SQL Server from file.
debug: Chunk size: 4096 bytes
SQL Server 'DSHB-1' Message 5701: Changed database context to 'MyDB'.
SQL Server 'DSHB-1' Message 5701: Changed database context to 'MyDB'. (Concerning line 1)
debug: Query: select ctext from test where cid = 1
debug: File 'a.txt' opened for read
debug: File is 639 bytes long
debug: Read 639 bytes from file
debug: File closed
Data copied into SQL Server text column from file 'a.txt'.
C:/>textcopy /I /Usa /Ppwd /S. /DMyDB /Ttest /Ccimage /W"where cid = 1" /Fa.bmp /Z
TEXTCOPY Version 1.0
DB-Library version 8.00.194
debug: Final parameters:
debug: Server: .
debug: Login: sa
debug: Password:
debug: Database: MyDB
debug: Table: test
debug: Column: cimage
debug: Where clause: where cid = 1
debug: File: a.bmp
debug: Direction: Into SQL Server from file.
debug: Chunk size: 4096 bytes
SQL Server 'DSHB-1' Message 5701: Changed database context to 'MyDB'.
SQL Server 'DSHB-1' Message 5701: Changed database context to 'MyDB'. (Concerning line 1)
debug: Query: select cimage from test where cid = 1
debug: File 'a.bmp' opened for read
debug: File is 3510 bytes long
debug: Read 3510 bytes from file
debug: File closed
Data copied into SQL Server image column from file 'a.bmp'.
}
{
By the way, you should insert something into text/image column before copy text/image into it. I mean, this value should not be null. You should write (for example):
INSERT INTO [dbo].[images] VALUES ('1', 0x0, null)
instead of:
INSERT INTO [dbo].[images] VALUES ('1', null, null)
Otherwise, you will get the following error message:
ERROR: Text or image pointer and timestamp retrieval failed.
}
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, ADODB, StdCtrls, DBCtrls;
type
TForm1 = class(TForm)
ADOTable1: TADOTable;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
DBMemo1: TDBMemo;
DBImage1: TDBImage;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
if object_id('test', 'U') is not null
drop table test
go
create table test(cid int identity, ctext text, cimage image)
insert test(ctext, cimage) select '', 0x0
}
{
C:/>textcopy /S. /Usa /P /DMyDB /Ttest /Cctext /W"where cid = 1" /Fa.txt /I /Z
TEXTCOPY Version 1.0
DB-Library version 8.00.194
debug: Final parameters:
debug: Server: .
debug: Login: sa
debug: Password:
debug: Database: MyDB
debug: Table: test
debug: Column: ctext
debug: Where clause: where cid = 1
debug: File: a.txt
debug: Direction: Into SQL Server from file.
debug: Chunk size: 4096 bytes
SQL Server 'DSHB-1' Message 5701: Changed database context to 'MyDB'.
SQL Server 'DSHB-1' Message 5701: Changed database context to 'MyDB'. (Concerning line 1)
debug: Query: select ctext from test where cid = 1
debug: File 'a.txt' opened for read
debug: File is 639 bytes long
debug: Read 639 bytes from file
debug: File closed
Data copied into SQL Server text column from file 'a.txt'.
C:/>textcopy /I /Usa /Ppwd /S. /DMyDB /Ttest /Ccimage /W"where cid = 1" /Fa.bmp /Z
TEXTCOPY Version 1.0
DB-Library version 8.00.194
debug: Final parameters:
debug: Server: .
debug: Login: sa
debug: Password:
debug: Database: MyDB
debug: Table: test
debug: Column: cimage
debug: Where clause: where cid = 1
debug: File: a.bmp
debug: Direction: Into SQL Server from file.
debug: Chunk size: 4096 bytes
SQL Server 'DSHB-1' Message 5701: Changed database context to 'MyDB'.
SQL Server 'DSHB-1' Message 5701: Changed database context to 'MyDB'. (Concerning line 1)
debug: Query: select cimage from test where cid = 1
debug: File 'a.bmp' opened for read
debug: File is 3510 bytes long
debug: Read 3510 bytes from file
debug: File closed
Data copied into SQL Server image column from file 'a.bmp'.
}
{
By the way, you should insert something into text/image column before copy text/image into it. I mean, this value should not be null. You should write (for example):
INSERT INTO [dbo].[images] VALUES ('1', 0x0, null)
instead of:
INSERT INTO [dbo].[images] VALUES ('1', null, null)
Otherwise, you will get the following error message:
ERROR: Text or image pointer and timestamp retrieval failed.
}
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, ADODB, StdCtrls, DBCtrls;
type
TForm1 = class(TForm)
ADOTable1: TADOTable;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
DBMemo1: TDBMemo;
DBImage1: TDBImage;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.