sql-server – 从字符串转换为uniqueidentifier时转换失败 – 两个GUID

我不明白为什么我不能插入这个.我找不到问题.错误消息是
字符串转换为唯一标识符时转换失败.

GUID是当我从一些其他表中选择时获得的GUID.

insert into [db].[dbo].[table] (myid,friendid,time1,time2) values
 ( CONVERT(uniqueidentifier,'0C6A36BA-10E4-438F-BA86-0D5B68A2BB15'),CONVERT(uniqueidentifier,'DF215E10-8BD4-4401-B2DC-99BB03135F2E'),'2014-01-05 02:04:41.953','2014-01-05 12:04:41.953')

我使用sql Server 2012

列是

id        uniqueidentifier,myid      uniqueidentifier,friendid  uniqueidentifier,time1     datetime nullable,time2     datetime nullable

解决方法

问题是ID列没有获得任何值.我在@Martin Smith sql fiddle看到他用DEFAULT newid声明了ID列,我没有

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...