sqlserver 操作binary和varbinary字段

sqlserver 操作binary和varbinary字段

USE [TSBLMS_7805]
GO

/****** Object:  Table [dbo].[aa]    Script Date: 2020/09/16 15:32:29 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[aa](
	[a1] [varbinary](max) NULL,
	[a2] [binary](50) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO



declare @a1 varbinary(50)
declare @a2 binary(50)

set @a1=cast('123' as varbinary(3)) + cast('456' as varbinary(3))
set @a2=cast('123' as binary(3))


insert into aa (a1,a2) values(@a1,@a2)
select a1,a2 from aa

  

posted @ 2020-09-16 15:36  奥兰王子  阅读(1959)  评论(0编辑  收藏  举报