从数据库中批量提取数据

时间:2013-11-11 10:35:52
【文件属性】:

文件名称:从数据库中批量提取数据

文件大小:709B

文件格式:TXT

更新时间:2013-11-11 10:35:52

select,update,where,declare

declare @XM varchar(100),@COUNT INT,@YXM VARCHAR(1000),@ID VARCHAR(1000) Declare XM_Cursor CURSOR FOR SELECT XM,ID FROM JCXX WHERE XM LIKE '%(%' OPEN XM_Cursor FETCH FROM XM_Cursor into @XM,@ID WHILE @@FETCH_STATUS=0 BEGIN set @COUNT = PATINDEX( '%(%', @XM) IF @COUNT > 0 BEGIN SET @YXM = SUBSTRING(@XM,0,@COUNT) UPDATE JCXX SET XM = @YXM WHERE ID = @ID PRINT @YXM END FETCH NEXT FROM XM_Cursor into @XM,@ID END close XM_Cursor DEALLOCATE XM_Cursor update jcxx set xm = substring(xm,0,CHARINDEX('(',xm)) where xm like '%(%' update jcxx set xm = xm=left(xm,CHARINDEX('(',xm)-1) where xm like '%(%'


网友评论

  • 我正需要的东西!很好谢谢!