我取得了一个uniqueidentifier值,用SQL语句取得的,取得后是一个字符串,我想把它又写入另一个表,但是发行无法转换字符串到这个类型 
我直接用的Insert   into   table   (某一个uniqueidentifier类型字段,...)   value   (string类型uniqueidentifier值,,,) 
应该怎么办啊?

解决方案 »

  1.   

    应该可以吧
    declare @t table(a uniqueidentifier)
    insert into @t 
    select newid() union all
    select N'E5BE4AE0-BC90-4BE4-8EB0-7B968A53161D' select * from @t
    /*(所影响的行数为 2 行)a                                    
    ------------------------------------ 
    091CA375-BEA7-4983-8AB5-A9EB315C4269
    E5BE4AE0-BC90-4BE4-8EB0-7B968A53161D(所影响的行数为 2 行)
    */
      

  2.   

    declare @T table (id uniqueidentifier)declare @Str varchar(36)
    set @Str = newid()
    select @Strinsert @T select newid()
    insert @T select @Strselect * from @T