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

时间:2013-08-19 12:00:29

标签: sql sql-server sql-server-2008-r2 temp

错误:没有足够的结果空间将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。 你认为我怎么能在这种情况下修复错误?

1 个答案:

答案 0 :(得分: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'