Table.AddKey
语法
Table.AddKey(table as table, columns as list, isPrimary as logical) as table
关于
向 table
添加一个键,其中 columns
是定义该键的列名称列表,isPrimary
指定该键是否为主键。
示例 1
向表添加单列主键。
使用情况
let
table = Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
}),
resultTable = Table.AddKey(table, {"Id"}, true)
in
resultTable
输出
Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
})