--示例存储过程
create proc p_save
as
--分拆关键字并插入 t_keywords
select top 8000 id=identity(int,1,1) into # from syscolumns a,syscolumns binsert t_keywords(keyword)
select distinct 
keyword=substring(keyword,b.id,charindex(',',keyword+',',b.id)-b.id)
from t_picinfo a,# b
where b.id<=len(keyword) and substring(','+keyword,b.id,1)=','
and not exists(
select * from t_keywords aa
where aa.keyword=substring(a.keyword,b.id,charindex(',',a.keyword+',',b.id)-b.id))