1

错误:结果空间不足,无法将 uniqueidentifier 值转换为 char。

我有一张临时表

SELECT
  urlid, -- This coulmn does not exist in Phrase table I would like to declare it uniqueidentifier
  P.subDomainId,
  P.RegionID            
  INTO #tempcom     
FROM
    Phrase P

当我使用此查询更新#tempcom 表时

   Declare @urlid as uniqueidentifier
   Set @urlid = '4c595d6c-1e8a-45cf-aaf2-fe5a45b881b9'
   UPDATE T SET T.urlid = @urlid From #tempcom T Where T.subdomain = 'www.borasloppis.se'

它抛出错误:结果空间不足,无法将 uniqueidentifier 值转换为 char。您认为在这种情况下我该如何解决错误?

4

1 回答 1

2

试试这个——

SELECT  
      NEWID() AS urlid --<-- column with GUID datatype
    , P.subDomainId
    , P.RegionID
INTO #tempcom
FROM dbo.Phrase P

更新 -

DECLARE @urlid AS UNIQUEIDENTIFIER
SET @urlid = '4c595d6c-1e8a-45cf-aaf2-fe5a45b881b9'

UPDATE #tempcom
SET urlid = @urlid
WHERE subdomain = 'wwww.borasloppis.se'
于 2013-08-19T12:03:30.253 回答