如何通过存储过程把含有关键字“苹果”的文章的类别字段标志为1,含有“镜子”的文章的类别字段标志为为2,如此类推?

解决方案 »

  1.   

    create proc sp_update
    asset xact_abort onbegin tranupdate 表名 set 类别 = 1 where 文章内容字段 like '%苹果%'update 表名 set 类别 = 2 where 文章内容字段 like '%镜子%'
    commit tranreturn 0
      

  2.   

    create proc p_TEST
    as
    UPDATE yTABLE SET TYPE = 1 WHERE CHARINDEX('苹果',yCOL) > 0
    UPDATE yTABLE SET TYPE = 2 WHERE CHARINDEX('镜子',yCOL) > 0 GO
      

  3.   

    create procedure P
    as
      update table set type = 1 where *** like '$苹果$'
      update table set type = 2 where *** like '$镜子$'
    go