set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[updatetushufenlei_beifabook]

AS
begin
declare @id int
declare @productname nvarchar(500)
declare @SearchKeyword varchar(1000)
declare @sql varchar(1000)
declare @zhi varchar(1000)
set @zhi=' 北发图书网'+' 品牌::品牌 商家:100057:商家 分类:05:分类'

--申明一个游标
DECLARE authors_cursor CURSOR FOR
SELECT   id, productname FROM gwkproduct where ident like 'beifabook_%' and (BrowseNodeKeyword ='' or BrowseNodeKeyword is  null)
--打开游标
OPEN authors_cursor
--取出值
FETCH NEXT FROM authors_cursor INTO @id, @productname
--循环取出游标的值
WHILE @@FETCH_STATUS = 0
BEGIN
Print @id
Print @productname
Print '‘ ’ '
update gwkproduct set bdel='1', SearchKeyword='05',BrowseNodeKeyword=@productname +@zhi where id=@id
FETCH NEXT FROM authors_cursor
INTO @id, @productname
END
CLOSE authors_cursor --关闭游标
DEALLOCATE authors_cursor --释放游标


--execute sp_executesql
--sp_executesql(@sql)
end;