table align="left" cellpadding="0" cellspacing="0" border="0" >
<tr>
<td align="center"><script language='javascript' src='http://www.iTbulo.com/gg/200703/78.js'></script></td>
</tr>
</table><SPAN class=t18>
<P>在sql中创建用户自定义拼音函数:<BR> create function f_GetPy(@Str nvarchar(400))<BR> returns nvarchar(4000)<BR> as<BR> begin<BR> declare @strlen int,@re nvarchar(4000)<BR> declare @t table(chr nchar(1) collate Chinese_PRC_CI_AS,letter nchar(1))<BR> insert @t select '吖','A' union all select '八','B'<BR> union all select '嚓','C' union all select '咑','D'<BR> union all select '妸','E' union all select '发','F'<BR> union all select '旮','G' union all select '铪','H'<BR> union all select '丌','J' union all select '咔','K' <BR> union all select '垃','L' union all select '嘸','M'<BR> union all select '拏','N' union all select '噢','O'<BR> union all select '妑','P' union all select '七','Q'<BR> union all select '呥','R' union all select '仨','S'<BR> union all select '他','T' union all select '屲','W'<BR> union all select '夕','X' union all select '丫','Y'<BR> union all select '帀','Z'</P>
<P> select @strlen=len(@str),@re=''<BR> while @strlen>0<BR> begin<BR> select top 1 @re=letter+@re,@strlen=@strlen-1<BR> from @t a where chr<=substring(@str,@strlen,1)<BR> order by chr desc<BR> if @@rowcount=0<BR> select @re=substring(@str,@strlen,1)+@re,@strlen=@strlen-1<BR> end<BR> return(@re)<BR> end<BR> go<BR> --测试<BR> select dbo.f_GetPy('东莞市') as 东莞市,dbo.f_GetPy('ab中c国人') as 中国人</P>
<P> --以后查询的时候,就可以调用上面的函数来实现汉字模糊查询</P>
<P> select * from 表 where dbo.f_getpy(字段)='zgyh' </P></SPAN><script language='javascript' src='http://www.iTbulo.com/gg/200703/79.js'></script></td>
</tr>
</table>
</td>
<td width="1" valign="top" bgcolor="#A8A8A8"></td>
<td width="173" valign="top" bgcolor="F3F3F3">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="21" align="center" valign="middle" bgcolor="DFDFDF"><strong>文章搜索</strong></td>
</tr>
<tr>
<td height="2" bgcolor="A3A3A3"></td>
</tr>
<form method="Get" name="SearchForm" action="/Search.asp" target="_blank"><TR>
<TD height="40" align=center><input name="Field" type="hidden" id="Field" value="Title"><INPUT name=Keyword id="Keyword" size=16> <INPUT type=submit value=搜索 name=submit onClick="if(this.form.Keyword.value=='') {alert('请输入关键字');return false;}"></TD></TR></FORM>
<tr>
<td height="21" align="center" valign="middle" bgcolor="DFDFDF"><strong>

订阅我的BLOG(RSS)