简体   繁体   English

SQL Server VARBINARY(最大)

[英]SQL Server VARBINARY(MAX)

I have a stored procedure that inserts a varchar & VARBINARY(MAX) values in the table. 我有一个存储过程,可以在表中插入varcharVARBINARY(MAX)值。 I pass ac# byte[] to the varbinary(max) field. 我将ac# byte[]传递给varbinary(max)字段。 I also see that the size of the byte[] size is 80142 which satisfies the max limit of varbinary . 我还看到byte[] size的大小是80142,它满足varbinary的最大限制。 Stored procedure executes without any errors. 存储过程执行无任何错误。 But when I try to query that table I see empty values in the varbinary datatype. 但是,当我尝试查询该表时,在varbinary数据类型中看到空值。

SQL sp 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 C#代码

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. 我非常确定SQL Server Management Studio将不会显示太长的值(我不知道限制),即使该值在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL Server VARBINARY(max) 到 c# byte[] - SQL Server VARBINARY(max) to c# byte[] 从SQL Server VarBinary(Max)读取图像 - Read Image from SQL Server VarBinary(Max) 从SQL Server读取VARBINARY(MAX)到C# - Read VARBINARY(MAX) from SQL Server to C# SQL Server:CLR RijndaelManaged字节不能从varbinary(max)正确解密 - SQL Server : CLR RijndaelManaged bytes not decrypting correctly from varbinary(max) 如何在 SQL Server 中存储和检索 varbinary(max) 列 - How to Store and Retrieve a varbinary(max) Column in SQL Server 从SQL Server中检索varbinary(MAX)到C#中的byte [] - Retrieve varbinary(MAX) from SQL Server to byte[] in C# 使用varbinary(max)的SQL Server中的默认配置文件图片 - Default profile picture in sql server using varbinary(max) 将存储在SQL XML参数中的byte []存储到SQL Server 2005中的varbinary(MAX)字段。可以完成吗? - Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be done? 需要使用C#从SQL Server 2014到Xamarin检索图像(Varbinary MAX) - Need to retrieve images (Varbinary MAX) from SQL Server 2014 to Xamarin by using C# 如果我查询SQL Server VarBinary(MAX)列,是否会在内存中加载整个文件? - If I Query a SQL Server VarBinary(MAX) Column, Will the Entire File be Loaded In Memory?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM