简体   繁体   中英

SQL Server VARBINARY(MAX)

I have a stored procedure that inserts a varchar & VARBINARY(MAX) values in the table. I pass ac# byte[] to the varbinary(max) field. I also see that the size of the byte[] size is 80142 which satisfies the max limit of varbinary . Stored procedure executes without any errors. But when I try to query that table I see empty values in the varbinary datatype.

SQL sp

 ALTER PROCEDURE [dbo].[Test] 
            -- Add the parameters for the stored procedure here
            @PNumber varchar(50)
            ,@Byte varbinary(max)
        AS
        BEGIN
            SET NOCOUNT ON;

            -- Insert statements for procedure here
            INSERT INTO [Test].[dbo].[Data]
                   ([PNumber]
                   ,[PByte])
             VALUES
                   (@PNumber
                   ,@Byte)
        END

C# CODE

byte[] theData = doc.GetData();

DAL_DataTableAdapters.QueriesTableAdapter qta = new DAL_DataTableAdapters.QueriesTableAdapter();

qta.Test("test", theData);

Table structure:

CREATE TABLE [dbo].[Data]
(
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [PNumber] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [PByte] [varbinary](max) NULL
) ON [PRIMARY]

How do you determine that the data is empty? I'm quite certain that SQL Server Management Studio will not display a value that is too long (I don't know the limit), even when the value is there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM