意思就是把BB中的日改成AA中的日

解决方案 »

  1.   

    update  表  set bb=left(convert(varchar(10),bb,120),8)+right(convert(varchar(10),aa,120),2)
      

  2.   

    给来个yyyy-mm-dd形式的可以不?谢谢
      

  3.   

    if exists(select * from dbo.sysobjects where id=object_id(N'[dbo].[testaa]') and objectproperty(id,'istable')=1)
       drop table [dbo].[testaa] 
    if exists(select * from dbo.sysobjects where id=object_id(N'[dbo].[testbb]') and objectproperty(id,'istable')=1)
       drop table [dbo].[testbb]
    create table testaa(id int identity(1,1),d datetime)
    insert into testaa select '2005-1-15'
    union all select '2005-2-2'
    create table testbb(id int identity(1,1),d datetime)
    insert into testbb select '2005-1-9'
    union all select '2005-2-28'select * from testaa
    select * from testbbupdate  testaa  set d=left(convert(varchar(10),a.d,120),8)+right(convert(varchar(10),b.d,120),2)
    from testaa a
    inner join testbb b
    on a.id=b.idselect * from testaa
    select * from testbb