SSMS 编辑单元格无法插入行 - 无效的 uuid - 如何将有效的 uuid 粘贴到编辑前 200 行的单元格中?

SSMS Editing cell unable to insert row - invalid uuid - how to paste a valid uuid into a cell in edit top 200 rows?

在 SSMS 中,尝试通过编辑前 200 行来添加一些测试数据。如何将 uuid 粘贴到单元格中?我正在尝试不必编写插入语句。

已尝试从 an online uuid generator 获取 uuid - 尝试了此生成器的所有格式。查看其他堆栈溢出问题似乎与编程有关,而不是与 uuid 编辑问题有关。尝试添加用单引号和不带单引号括起来的 uuid。

错误消息说:

You cannot use the results pane to set this field to values other than null

我认为这意味着您不能在网格中提供 guid,您必须将其保留为空

该列是否具有默认值 NewID()?如果是这样,它应该在您提交该行时自行填充(聚焦另一行)

如果不是,请尝试通过编写 INSERT 语句插入数据:

INSERT INTO table(list,of,columns,except,auto,generated,ones)
VALUES ('list','of','values'...)

或来自其他地方的 selecting/modifying 他们:

INSERT INTO table(list,of,columns,except,auto,generated,ones)
SELECT mixed,'list','of','values',and,columns
FROM othertable 

unfortunately the field is defined as binary 16, not null.

据我所知,企业管理器不允许粘贴到二进制字段。

如果您使用 uniqueidentifier 的正确数据类型定义列,您的粘贴应该可以正常工作。

https://docs.microsoft.com/en-us/sql/t-sql/data-types/uniqueidentifier-transact-sql?view=sql-server-2017

解决方法不是使用 INSERT 语句(尽管这是目前的解决方法),而是使用正确的数据类型。

作为一个额外的好处,uniqueidentifier 列不允许无效值,而 binary 将处理您可以塞入其中的任何字节。