sqlServer中有两个扩展存储过程实现Scanf和Printf功能,恰当的使用它们可以在提取和拼接字符串时大幅度简化sql代码。1、xp_sscanf,用它可以分解格式相对固定的字符串,这对于厌倦使用一堆substring和charindex的朋友来说不错。比如前几天的一个帖子中提出的如何分解ip地址,相对简练且通用的代码应该是下面这样
<div class="codetitle"><a style="CURSOR: pointer" data="88018" class="copybut" id="copybut88018" onclick="doCopy('code88018')"> 代码如下: