本帖最后由 xuyang2004 于 2010-04-06 11:05:02 编辑

解决方案 »

  1.   

    update dance set a=0,b=0,c=0 where charindex(','+ltrim(id)+',',','+@wher+',')>0 and n=417
      

  2.   

    update dance set a=0,b=0,c=0 where id in(1,2,3,4,5) and n=417 
      

  3.   


    update
     dance 
    set
     a=0,b=0,c=0 
    where
     charindex(','+ltrim(id)+',',','+@wher+',')>0 and n=417
      

  4.   

    insert into dance (a,b,c) value(0,0,0) Where charindex(','+ltrim(id)+',',','+@id +',')>0 and n=417
    OR:update dance set a=0,b=0,c=0 where charindex(','+ltrim(id)+',',','+@id+',')>0 and n=417想要哪个
      

  5.   

    楼上的两位,抱歉我写错了,修改下:·id=1,2,3,4,5
    我想把@id=1 =2 =3 =4 =5的这5条记录 and n=417 的a b c字段全部添加到另一张表中,其中a,b,c要等于0, 请问各位大哥这样的语句怎么写?
      

  6.   

    insert into dance (a,b,c) 
    SELECT 0,0,0 FROM DANCE
     Where charindex(','+ltrim(id)+',',','+@id +',')>0 and n=417
      

  7.   

    create proc updateinfo
    (
      @IDS nvarchar(20)
    )
    as
    exec('update '+@TableName+' set set a=0,b=0,c=0 where n=417 and ID in'+'('+@IDS+')'
      

  8.   

    insert into
     dance (a,b,c) 
    select
     0,0,0 from dance
    where
     charindex(','+ltrim(id)+',',','+@id +',')>0 and n=417
      

  9.   

    楼上的大哥,请问select 后面0,0,0是否可以修改成自己想要添加进去的值?
      

  10.   

    select *  into # from
    (
    select * from DANCE where id in(1,2,3,4,5)
    union all
    select * from DANCE where n=417
    ) ttt
      

  11.   

    select *  into # from
    (
    select '第一个值','第2个值','第3个值' from DANCE where id in(1,2,3,4,5)
    union all
    select '第一个值','第2个值','第3个值' from DANCE where n=417
    ) ttt