sqlserver2016版添加的json操作


sqlserver自帶的json的操作主要能實現:json驗證、字段提取、修改、表格轉json、json轉表格式

一、isjson實現json驗證

--結果:1-json格式正確;0-json格式錯誤
declare @json1 nvarchar(max) = '{"id":1,"name":"ki","age":22,"son":{"name":"son","age":1},"list":[{"city":"上海","area":"松江"},{"city":"上海","area":"松江"}]}'
print isjson(@json1)

結果:1

二、JSON_VALUE取出json值

--只能取出json值,無法取出對象和數組
declare @json2 nvarchar(max) = '{"id":1,"name":"ki","ages":["22","33"],"son":{"name":"son","age":1},"list":[{"city":"上海","area":"松江"},{"city":"上海","area":"松江"}]}'
select JSON_VALUE(@json2,'$.name')
--取出數組中的單個值
select JSON_VALUE(@json2,'$.ages[0]')

三、JSON_QUERY取出json中的對象和數組

declare @json3 nvarchar(max) = '{"id":1,"name":"ki","age":22,"son":{"name":"son","age":1},"list":[{"city":"上海","area":"松江"},{"city":"上海","area":"松江"}]}'
select JSON_QUERY(@json3,'$.son')
select JSON_QUERY(@json3,'$.list')

結果:

結果1:{"name":"son","age":1}
結果2:[{"city":"上海","area":"松江"},{"city":"上海","area":"松江"}]

 

四、JSON_MODIFY修改json對象和值

JSON_MODIFY可以實現修改value(包括:字符串、數組、子json),刪除鍵值對,重命名key

declare @json4 nvarchar(max) = '{"id":1,"name":"ki","ages":[22,33],"son":{"name":"son","age":1},"list":[{"city":"上海","area":"松江"},{"city":"上海","area":"松江"}]}'
--a.修改值,默認修改字符串。無法直接修改對象
SET @json4=JSON_MODIFY(@json4,'$.name','newNmae')
select @json4
--修改數組的值
SET @json4=JSON_MODIFY(@json4,'$.ages[0]',55)
select @json4
--追加append,將值追加到數組末尾
SET @json4=JSON_MODIFY(@json4,'append $.ages',55)
select @json4
--lax/strict
--新增鍵值對,如果要修改的key在json中不存在默認新建,默認是lax。
--如果使用了strict,則要修改的key必須在json中存在,否則會報錯
SET @json4=JSON_MODIFY(@json4,'lax $.newKey','test')
select @json4
-- SET @json4=JSON_MODIFY(@json4,'strict $.newKey2','test')--該行報錯

--刪除一個key-value
--將value設置成null,則該key-vaule消失
SET @json4=JSON_MODIFY(@json4,'$.newKey',null)
select @json4

--b.多次修改,使用嵌套方式
SET @json4=JSON_MODIFY(JSON_MODIFY(@json4,'$.name','hello'),'append $.ages',33)
select @json4

--c.修改對象(子json和數組)
--使用JSON_QUERY方法,將要修改的的新值使用JSON_QUERY輸出,保證sqlserver能識別出該值為對象

--修改子json實例
SET @json4=JSON_MODIFY(@json4,'$.son',JSON_QUERY(JSON_MODIFY(@json4,'$.son.age',18),'$.son'))
select @json4

--修改數組
SET @json4=JSON_MODIFY(@json4,'$.ages',JSON_QUERY(JSON_MODIFY(@json4,'$.ages[0]',1111),'$.ages'))
select @json4

--d.重命名key
--先向json中新增一個新的key-value,value與原值相同,key是新值;然后將原key的value設置為null。原key將自動消失。
SET @json4=JSON_MODIFY(JSON_MODIFY(@json4,'$.msgId',1),'$.id',null)
select @json4

 

五、json字符串轉化成表格式

--如果沒有數組,可以將OUTER APPLY OPENJSON() WITH()省略
declare @json5 nvarchar(max) = '{"id":1,"name":"ki","age":22,"son":{"name":"son","age":1},"list":[{"city":"上海","area":"青浦"},{"city":"上海","area":"松江"}]}'

select * from openjson(@json5)
with(
    id nvarchar(500) 'strict $.id',--strict表示json中必須包含該字段
    name nvarchar(500) 'strict $.name',
    age nvarchar(500) 'strict $.age',
    son_name nvarchar(500) 'strict $.son.name',
    son_age nvarchar(500) 'strict $.son.age',
    list nvarchar(max) '$.list' AS JSON--必須是nvarchar(max) 類型
)
OUTER APPLY OPENJSON(list)
  WITH(
            city varchar(80) '$.city',
            area varchar(80) '$.area'
            );
--更多級json的轉化 declare @json51 nvarchar(max) = '{"msgId":"msgId666","orderNo":"00000","orderType":"00000","orderLevel":"00000","goodsList":[{"lineNo":0,"shipperId":"0021","goodsId":"0021","goodsName":"一年級語文","barCode":"9787107291029","sortPortList":[{"equipmentId":"equipmentId","sortPortId":"4","masUnitQty":"40"},{"equipmentId":"equipmentId","sortPortId":"6","masUnitQty":"30"}]},{"lineNo":0,"shipperId":"0000","goodsId":"0000","goodsName":"一年級數學","barCode":"9787107291029","sortPortList":[{"equipmentId":"equipmentId","sortPortId":"8","masUnitQty":"10"},{"equipmentId":"equipmentId","sortPortId":"10","masUnitQty":"20"}]},{"lineNo":0,"shipperId":"0021","goodsId":"0021","goodsName":"大學語文","barCode":"9787519117429","sortPortList":[{"equipmentId":"equipmentId","sortPortId":"14","masUnitQty":"49"},{"equipmentId":"equipmentId","sortPortId":"16","masUnitQty":"39"}]},{"lineNo":0,"shipperId":"0000","goodsId":"0000","goodsName":"大學數學","barCode":"9787519117429","sortPortList":[{"equipmentId":"equipmentId","sortPortId":"18","masUnitQty":"18"},{"equipmentId":"equipmentId","sortPortId":"20","masUnitQty":"21"}]}]}' select msg_id,order_no,order_type,order_level,line_no,shipper_id,goods_id,goods_name,barcode,equipment_id,sort_port_id,mas_unit_qty from openjson(@json51) with( msg_id nvarchar(500) '$.msgId',--strict表示json中必須包含該字段 order_no nvarchar(500) '$.orderNo', order_type nvarchar(500) '$.orderType', order_level nvarchar(500) '$.orderLevel', list nvarchar(max) '$.goodsList' AS JSON--必須是nvarchar(max) 類型 ) OUTER APPLY OPENJSON(list) WITH( line_no nvarchar(500) '$.lineNo', shipper_id nvarchar(500) '$.shipperId', goods_id nvarchar(500) '$.goodsId', goods_name nvarchar(500) '$.goodsName', barcode nvarchar(500) '$.barCode', twicelist nvarchar(max) '$.sortPortList' AS JSON--必須是nvarchar(max) 類型 ) OUTER APPLY OPENJSON(twicelist) WITH( equipment_id nvarchar(500) '$.equipmentId', sort_port_id nvarchar(500) '$.sortPortId', mas_unit_qty nvarchar(500) '$.masUnitQty' )

 

結果:

 

 

 

 

 

六、將表格式轉化成json格式

轉換出單個子json實例

--for json auto 安裝原列名自動轉化
--for json path 指定輸出json的key名稱,並可以控制輸出字段
-- for json auto,WITHOUT_ARRAY_WRAPPER    跟在for json auto/path后可以刪除中括號
select * from student for json auto
select * from student for json auto,WITHOUT_ARRAY_WRAPPER
select 
         id as uniqueId,
         name,
         name as 'info.name'
         from student for json path

結果:

結果:1[{"id":1,"name":"ki","age":34,"create_time":"2020-09-01T11:12:43.230"},{"id":2,"name":"李四","age":33,"create_time":"2020-09-01T11:12:43.230"},{"id":3,"name":"ki","age":34,"create_time":"2020-09-01T11:12:50.987"},{"id":4,"name":"李四a","age":33,"create_time":"2020-09-01T11:12:50.987"}]
結果2:{"id":1,"name":"ki","age":34,"create_time":"2020-09-01T11:12:43.230"},{"id":2,"name":"李四","age":33,"create_time":"2020-09-01T11:12:43.230"},{"id":3,"name":"ki","age":34,"create_time":"2020-09-01T11:12:50.987"},{"id":4,"name":"李四a","age":33,"create_time":"2020-09-01T11:12:50.987"}
結果3:[{"uniqueId":1,"name":"ki","info":{"name":"ki"}},{"uniqueId":2,"name":"李四","info":{"name":"李四"}},{"uniqueId":3,"name":"ki","info":{"name":"ki"}},{"uniqueId":4,"name":"李四a","info":{"name":"李四a"}}]

上述方式雖然可以直接建立子json,但是對數組個數不明確的數據無法轉換。這時可以使用關聯表的方式建立,如果數據都在一張表中,需要使用自連接。通過別名確定json對象數的名稱。

注:結尾必須是auto不能是path

另外,對於固定值如('1' as taskFinishStatus 和 'pcs' as masureUnit,),寫在哪一級json字段后面,生成json后就會在哪一級。

--json auto,結尾必須是auto不能是path
DECLARE @json varchar(max) = ''
set @json = (select distinct
                                    a.msg_id as msgId,
                                    a.order_no as orderNo,
                                    a.order_type as orderType,
                                    a.order_level as orderLevel,
                                    '1' as taskFinishStatus,
                                    
                                    goodsList.line_no as [lineNo],
                                    goodsList.shipper_id as shipperId,
                                    goodsList.goods_id as goodsId,
                                    goodsList.goods_name as goodsName,
                                    goodsList.barcode as barCode,
                                    
                                    sortPortList.equipment_id as equipmentId,
                                    sortPortList.sort_port_id as sortPortId,
                                    'pcs' as masureUnit,
                                    sortPortList.mas_unit_qty_sorted as masUnitQty,
                                    '1' as minUnitQty
                            from wms_to_wcs_task_ii as a 
                            join wms_to_wcs_task_ii as goodsList on a.msg_id=goodsList.msg_id 
                            join wms_to_wcs_task_ii as sortPortList on goodsList.goods_id=sortPortList.goods_id
                            where a.msg_id='msgId111'
                            for json auto,WITHOUT_ARRAY_WRAPPER)
                            
        select @json

結果:

{"msgId":"msgId111","orderNo":"00000","orderType":"00000","orderLevel":"00000","taskFinishStatus":"1","goodsList":[{"lineNo":"0","shipperId":"0000","goodsId":"00232300","goodsName":"一年級數學","barCode":"9787107291029","sortPortList":[{"equipmentId":"equipmentId","sortPortId":"10","masureUnit":"pcs","masUnitQty":0,"minUnitQty":"1"},{"equipmentId":"equipmentId","sortPortId":"8","masureUnit":"pcs","masUnitQty":0,"minUnitQty":"1"}]},{"lineNo":"0","shipperId":"0000","goodsId":"003300","goodsName":"大學數學","barCode":"9787519117429","sortPortList":[{"equipmentId":"equipmentId","sortPortId":"18","masureUnit":"pcs","masUnitQty":0,"minUnitQty":"1"},{"equipmentId":"equipmentId","sortPortId":"20","masureUnit":"pcs","masUnitQty":21,"minUnitQty":"1"}]},{"lineNo":"0","shipperId":"0021","goodsId":"0023421","goodsName":"一年級語文","barCode":"9787107291029","sortPortList":[{"equipmentId":"equipmentId","sortPortId":"4","masureUnit":"pcs","masUnitQty":0,"minUnitQty":"1"},{"equipmentId":"equipmentId","sortPortId":"6","masureUnit":"pcs","masUnitQty":0,"minUnitQty":"1"}]},{"lineNo":"0","shipperId":"0021","goodsId":"0033321","goodsName":"大學語文","barCode":"9787519117429","sortPortList":[{"equipmentId":"equipmentId","sortPortId":"14","masureUnit":"pcs","masUnitQty":0,"minUnitQty":"1"},{"equipmentId":"equipmentId","sortPortId":"16","masureUnit":"pcs","masUnitQty":0,"minUnitQty":"1"}]}]}

 

end、上方實例中使用到的表資源

student表數據:

/*
 Navicat Premium Data Transfer

 Source Server         : localSqlServer
 Source Server Type    : SQL Server
 Source Server Version : 14001000
 Source Host           : 127.0.0.1:1433
 Source Catalog        : custom
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 14001000
 File Encoding         : 65001

 Date: 19/01/2021 17:03:20
*/


-- ----------------------------
-- Table structure for student
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[student]') AND type IN ('U'))
    DROP TABLE [dbo].[student]
GO

CREATE TABLE [dbo].[student] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [name] varchar(5) COLLATE Chinese_PRC_CI_AS  NULL,
  [age] int  NULL,
  [create_time] datetime  NULL
)
GO

ALTER TABLE [dbo].[student] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Records of student
-- ----------------------------
SET IDENTITY_INSERT [dbo].[student] ON
GO

INSERT INTO [dbo].[student] ([id], [name], [age], [create_time]) VALUES (N'1', N'ki', N'34', N'2020-09-01 11:12:43.230')
GO

INSERT INTO [dbo].[student] ([id], [name], [age], [create_time]) VALUES (N'2', N'李四', N'33', N'2020-09-01 11:12:43.230')
GO

INSERT INTO [dbo].[student] ([id], [name], [age], [create_time]) VALUES (N'3', N'ki', N'34', N'2020-09-01 11:12:50.987')
GO

INSERT INTO [dbo].[student] ([id], [name], [age], [create_time]) VALUES (N'4', N'李四a', N'33', N'2020-09-01 11:12:50.987')
GO

SET IDENTITY_INSERT [dbo].[student] OFF
GO


-- ----------------------------
-- Auto increment value for student
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[student]', RESEED, 6)
GO


-- ----------------------------
-- Primary Key structure for table student
-- ----------------------------
ALTER TABLE [dbo].[student] ADD CONSTRAINT [PK__student__3213E83F18AD2C2B] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

 wms_to_wcs_task_ii 表數據:

/*
 Navicat Premium Data Transfer

 Source Server         : localSqlServer
 Source Server Type    : SQL Server
 Source Server Version : 14001000
 Source Host           : 127.0.0.1:1433
 Source Catalog        : custom
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 14001000
 File Encoding         : 65001

 Date: 09/03/2021 14:04:02
*/


-- ----------------------------
-- Table structure for wms_to_wcs_task_ii
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[wms_to_wcs_task_ii]') AND type IN ('U'))
    DROP TABLE [dbo].[wms_to_wcs_task_ii]
GO

CREATE TABLE [dbo].[wms_to_wcs_task_ii] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [msg_id] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [order_no] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [order_type] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [order_level] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [line_no] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [shipper_id] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [goods_id] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [goods_name] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [barcode] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [equipment_id] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [sort_port_id] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [mas_unit_qty] int  NULL,
  [mas_unit_qty_wcs_sorted] int DEFAULT ((0)) NULL,
  [mas_unit_qty_sorted] int DEFAULT ((0)) NULL,
  [creatime] datetime DEFAULT (getdate()) NULL,
  [update_time] datetime DEFAULT (getdate()) NULL
)
GO

ALTER TABLE [dbo].[wms_to_wcs_task_ii] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Records of wms_to_wcs_task_ii
-- ----------------------------
SET IDENTITY_INSERT [dbo].[wms_to_wcs_task_ii] ON
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'1', N'msgId666', N'00000', N'00000', N'00000', N'0', N'0021', N'0021', N'一年級語文', N'9787107291029', N'equipmentId', N'4', N'40', N'0', N'0', N'2021-01-25 01:33:37.673', N'2021-01-25 01:33:37.673')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'2', N'msgId666', N'00000', N'00000', N'00000', N'0', N'0021', N'0021', N'一年級語文', N'9787107291029', N'equipmentId', N'6', N'30', N'0', N'0', N'2021-01-25 01:33:37.673', N'2021-01-25 01:33:37.673')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'3', N'msgId666', N'00000', N'00000', N'00000', N'0', N'0000', N'0000', N'一年級數學', N'9787107291029', N'equipmentId', N'8', N'10', N'0', N'0', N'2021-01-25 01:33:37.673', N'2021-01-25 01:33:37.673')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'4', N'msgId666', N'00000', N'00000', N'00000', N'0', N'0000', N'0000', N'一年級數學', N'9787107291029', N'equipmentId', N'10', N'20', N'0', N'0', N'2021-01-25 01:33:37.673', N'2021-01-25 01:33:37.673')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'5', N'msgId666', N'00000', N'00000', N'00000', N'0', N'0021', N'0021', N'大學語文', N'9787519117429', N'equipmentId', N'14', N'49', N'0', N'0', N'2021-01-25 01:33:37.673', N'2021-01-25 01:33:37.673')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'6', N'msgId666', N'00000', N'00000', N'00000', N'0', N'0021', N'0021', N'大學語文', N'9787519117429', N'equipmentId', N'16', N'39', N'0', N'0', N'2021-01-25 01:33:37.673', N'2021-01-25 01:33:37.673')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'7', N'msgId666', N'00000', N'00000', N'00000', N'0', N'0000', N'0000', N'大學數學', N'9787519117429', N'equipmentId', N'18', N'18', N'0', N'0', N'2021-01-25 01:33:37.673', N'2021-01-25 01:33:37.673')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'8', N'msgId666', N'00000', N'00000', N'00000', N'0', N'0000', N'0000', N'大學數學', N'9787519117429', N'equipmentId', N'20', N'21', N'0', N'0', N'2021-01-25 01:33:37.673', N'2021-01-25 01:33:37.673')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'9', N'msgId111', N'00000', N'00000', N'00000', N'0', N'0021', N'0023421', N'一年級語文', N'9787107291029', N'equipmentId', N'4', N'40', N'0', N'0', N'2021-01-25 02:39:05.170', N'2021-01-25 02:39:05.170')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'10', N'msgId111', N'00000', N'00000', N'00000', N'0', N'0021', N'0023421', N'一年級語文', N'9787107291029', N'equipmentId', N'6', N'30', N'0', N'0', N'2021-01-25 02:39:05.170', N'2021-01-25 02:39:05.170')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'11', N'msgId111', N'00000', N'00000', N'00000', N'0', N'0000', N'00232300', N'一年級數學', N'9787107291029', N'equipmentId', N'8', N'10', N'0', N'0', N'2021-01-25 02:39:05.170', N'2021-01-25 02:39:05.170')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'12', N'msgId111', N'00000', N'00000', N'00000', N'0', N'0000', N'00232300', N'一年級數學', N'9787107291029', N'equipmentId', N'10', N'20', N'0', N'0', N'2021-01-25 02:39:05.170', N'2021-01-25 02:39:05.170')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'13', N'msgId111', N'00000', N'00000', N'00000', N'0', N'0021', N'0033321', N'大學語文', N'9787519117429', N'equipmentId', N'14', N'49', N'0', N'0', N'2021-01-25 02:39:05.170', N'2021-01-25 02:39:05.170')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'14', N'msgId111', N'00000', N'00000', N'00000', N'0', N'0021', N'0033321', N'大學語文', N'9787519117429', N'equipmentId', N'16', N'39', N'0', N'0', N'2021-01-25 02:39:05.170', N'2021-01-25 02:39:05.170')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'15', N'msgId111', N'00000', N'00000', N'00000', N'0', N'0000', N'003300', N'大學數學', N'9787519117429', N'equipmentId', N'18', N'18', N'0', N'0', N'2021-01-25 02:39:05.170', N'2021-01-25 02:39:05.170')
GO

INSERT INTO [dbo].[wms_to_wcs_task_ii] ([id], [msg_id], [order_no], [order_type], [order_level], [line_no], [shipper_id], [goods_id], [goods_name], [barcode], [equipment_id], [sort_port_id], [mas_unit_qty], [mas_unit_qty_wcs_sorted], [mas_unit_qty_sorted], [creatime], [update_time]) VALUES (N'16', N'msgId111', N'00000', N'00000', N'00000', N'0', N'0000', N'003300', N'大學數學', N'9787519117429', N'equipmentId', N'20', N'21', N'0', N'21', N'2021-01-25 02:39:05.170', N'2021-01-25 02:39:05.170')
GO

SET IDENTITY_INSERT [dbo].[wms_to_wcs_task_ii] OFF
GO


-- ----------------------------
-- Auto increment value for wms_to_wcs_task_ii
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[wms_to_wcs_task_ii]', RESEED, 16)
GO


-- ----------------------------
-- Primary Key structure for table wms_to_wcs_task_ii
-- ----------------------------
ALTER TABLE [dbo].[wms_to_wcs_task_ii] ADD CONSTRAINT [PK__wms_to_w__3213E83FCB118655] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM