Truncated varbinary(max) Data upon retrieval
Posted: Thu  26 Apr 2018 10:52
				
				Hi,
I'm having trouble reading from a varbinary(max) column (using a FileStream). The data is truncated once it is bigger than 10000000bytes.
I tried reading the same data from C# via its SqlConnection/SqlCommand/SqlDataReader classes and it works without a problem.
Table:
I'm using the following Delphi Code:
Afterwards Result has only 10000000bytes worth of data even if the Data stored is bigger than that.
C# Code that works:
Is this a bug or is there a setting with which I can change how much data should be read?
I'm using SDAC 8.0.2 .
			I'm having trouble reading from a varbinary(max) column (using a FileStream). The data is truncated once it is bigger than 10000000bytes.
I tried reading the same data from C# via its SqlConnection/SqlCommand/SqlDataReader classes and it works without a problem.
Table:
Code: Select all
CREATE TABLE [dbo].[TAB](
	[GEN] [int] IDENTITY(1,1) NOT NULL,
	[FILE_ID] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
	[FILE] [varbinary](max) FILESTREAM  NULL,
 CONSTRAINT [PK_TAB] PRIMARY KEY CLUSTERED 
(
	[GEN] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] FILESTREAM_ON [FSG_DMS],
 CONSTRAINT [CO_UNQ_FILE_ID] UNIQUE NONCLUSTERED 
(
	[FILE_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] FILESTREAM_ON [FSG_DMS]
Code: Select all
Result := TMemoryStream.Create;
qrySelect := TMSQuery.Create(nil);
qrySelect.CommandText := 'select FILE  from TAB where GEN = 1';
qrySelect.Open;
TBlobField(qrySelect.fctFieldByName('FILE')).SaveToStream(Result);
C# Code that works:
Code: Select all
var conn = new SqlConnection(@"Data Source=...;Integrated Security=True;Initial Catalog=...");
conn.Open();
var cmd = new SqlCommand("select FILE  from TAB where GEN = 1", conn);
var reader = cmd.ExecuteReader();
reader.Read();
var blob = reader.GetSqlBinary(0);
I'm using SDAC 8.0.2 .