- 浏览: 435603 次
- 性别:
- 来自: 唐山
文章分类
最新评论
-
hautbbs:
谢谢分享!
ASP.NET 导出Excel 和csv -
hautbbs:
感谢分享!
ASP.NET 导出Excel乱码的终极解决 -
wyf:
zcl920 写道只能说 看不懂。要发就发全 取一段出来 有什 ...
图片上绘制文字换行处理 -
zcl920:
只能说 看不懂。要发就发全 取一段出来 有什么用。
图片上绘制文字换行处理 -
380086154:
有用,谢谢。
js比较日期
一、打开vs2005 建立数据库项目。
using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using System.Text.RegularExpressions; public partial class StoredProcedures { [Microsoft.SqlServer.Server.SqlProcedure] public static void P_GetAllPY(SqlString hzString, out SqlString pyString) { // 匹配中文字符 Regex regex = new Regex("^[\u4e00-\u9fa5]$"); byte[] array = new byte[2]; int chrAsc = 0; pyString = ""; int i1 = 0; int i2 = 0; SqlChars noWChar = (SqlChars)hzString; for (int j = 0; j < noWChar.Length; j++) { // 中文字符 if (regex.IsMatch(noWChar[j].ToString())) { array = System.Text.Encoding.Default.GetBytes(noWChar[j].ToString()); i1 = (short)(array[0]); i2 = (short)(array[1]); chrAsc = i1 * 256 + i2 - 65536; if (chrAsc > 0 && chrAsc < 160) { pyString += noWChar[j].ToString(); } else { // 修正部分文字 if (chrAsc == -9254) // 修正“圳”字 pyString += "Zhen"; else { for (int i = (pyValue.Length - 1); i >= 0; i--) { if (pyValue[i] <= chrAsc) { pyString += pyName[i]; break; } } } } } // 非中文字符 else { pyString += noWChar[j].ToString(); } } } #region 拼音编码 private readonly static int[] pyValue = new int[] { -20319,-20317,-20304,-20295,-20292,-20283,-20265,-20257,-20242,-20230,-20051,-20036, -20032,-20026,-20002,-19990,-19986,-19982,-19976,-19805,-19784,-19775,-19774,-19763, -19756,-19751,-19746,-19741,-19739,-19728,-19725,-19715,-19540,-19531,-19525,-19515, -19500,-19484,-19479,-19467,-19289,-19288,-19281,-19275,-19270,-19263,-19261,-19249, -19243,-19242,-19238,-19235,-19227,-19224,-19218,-19212,-19038,-19023,-19018,-19006, -19003,-18996,-18977,-18961,-18952,-18783,-18774,-18773,-18763,-18756,-18741,-18735, -18731,-18722,-18710,-18697,-18696,-18526,-18518,-18501,-18490,-18478,-18463,-18448, -18447,-18446,-18239,-18237,-18231,-18220,-18211,-18201,-18184,-18183, -18181,-18012, -17997,-17988,-17970,-17964,-17961,-17950,-17947,-17931,-17928,-17922,-17759,-17752, -17733,-17730,-17721,-17703,-17701,-17697,-17692,-17683,-17676,-17496,-17487,-17482, -17468,-17454,-17433,-17427,-17417,-17202,-17185,-16983,-16970,-16942,-16915,-16733, -16708,-16706,-16689,-16664,-16657,-16647,-16474,-16470,-16465,-16459,-16452,-16448, -16433,-16429,-16427,-16423,-16419,-16412,-16407,-16403,-16401,-16393,-16220,-16216, -16212,-16205,-16202,-16187,-16180,-16171,-16169,-16158,-16155,-15959,-15958,-15944, -15933,-15920,-15915,-15903,-15889,-15878,-15707,-15701,-15681,-15667,-15661,-15659, -15652,-15640,-15631,-15625,-15454,-15448,-15436,-15435,-15419,-15416,-15408,-15394, -15385,-15377,-15375,-15369,-15363,-15362,-15183,-15180,-15165,-15158,-15153,-15150, -15149,-15144,-15143,-15141,-15140,-15139,-15128,-15121,-15119,-15117,-15110,-15109, -14941,-14937,-14933,-14930,-14929,-14928,-14926,-14922,-14921,-14914,-14908,-14902, -14894,-14889,-14882,-14873,-14871,-14857,-14678,-14674,-14670,-14668,-14663,-14654, -14645,-14630,-14594,-14429,-14407,-14399,-14384,-14379,-14368,-14355,-14353,-14345, -14170,-14159,-14151,-14149,-14145,-14140,-14137,-14135,-14125,-14123,-14122,-14112, -14109,-14099,-14097,-14094,-14092,-14090,-14087,-14083,-13917,-13914,-13910,-13907, -13906,-13905,-13896,-13894,-13878,-13870,-13859,-13847,-13831,-13658,-13611,-13601, -13406,-13404,-13400,-13398,-13395,-13391,-13387,-13383,-13367,-13359,-13356,-13343, -13340,-13329,-13326,-13318,-13147,-13138,-13120,-13107,-13096,-13095,-13091,-13076, -13068,-13063,-13060,-12888,-12875,-12871,-12860,-12858,-12852,-12849,-12838,-12831, -12829,-12812,-12802,-12607,-12597,-12594,-12585,-12556,-12359,-12346,-12320,-12300, -12120,-12099,-12089,-12074,-12067,-12058,-12039,-11867,-11861,-11847,-11831,-11798, -11781,-11604,-11589,-11536,-11358,-11340,-11339,-11324,-11303,-11097,-11077,-11067, -11055,-11052,-11045,-11041,-11038,-11024,-11020,-11019,-11018,-11014,-10838,-10832, -10815,-10800,-10790,-10780,-10764,-10587,-10544,-10533,-10519,-10331,-10329,-10328, -10322,-10315,-10309,-10307,-10296,-10281,-10274,-10270,-10262,-10260,-10256,-10254 }; private readonly static string[] pyName = new string[] { "A","Ai","An","Ang","Ao","Ba","Bai","Ban","Bang","Bao","Bei","Ben", "Beng","Bi","Bian","Biao","Bie","Bin","Bing","Bo","Bu","Ba","Cai","Can", "Cang","Cao","Ce","Ceng","Cha","Chai","Chan","Chang","Chao","Che","Chen","Cheng", "Chi","Chong","Chou","Chu","Chuai","Chuan","Chuang","Chui","Chun","Chuo","Ci","Cong", "Cou","Cu","Cuan","Cui","Cun","Cuo","Da","Dai","Dan","Dang","Dao","De", "Deng","Di","Dian","Diao","Die","Ding","Diu","Dong","Dou","Du","Duan","Dui", "Dun","Duo","E","En","Er","Fa","Fan","Fang","Fei","Fen","Feng","Fo", "Fou","Fu","Ga","Gai","Gan","Gang","Gao","Ge","Gei","Gen","Geng","Gong", "Gou","Gu","Gua","Guai","Guan","Guang","Gui","Gun","Guo","Ha","Hai","Han", "Hang","Hao","He","Hei","Hen","Heng","Hong","Hou","Hu","Hua","Huai","Huan", "Huang","Hui","Hun","Huo","Ji","Jia","Jian","Jiang","Jiao","Jie","Jin","Jing", "Jiong","Jiu","Ju","Juan","Jue","Jun","Ka","Kai","Kan","Kang","Kao","Ke", "Ken","Keng","Kong","Kou","Ku","Kua","Kuai","Kuan","Kuang","Kui","Kun","Kuo", "La","Lai","Lan","Lang","Lao","Le","Lei","Leng","Li","Lia","Lian","Liang", "Liao","Lie","Lin","Ling","Liu","Long","Lou","Lu","Lv","Luan","Lue","Lun", "Luo","Ma","Mai","Man","Mang","Mao","Me","Mei","Men","Meng","Mi","Mian", "Miao","Mie","Min","Ming","Miu","Mo","Mou","Mu","Na","Nai","Nan","Nang", "Nao","Ne","Nei","Nen","Neng","Ni","Nian","Niang","Niao","Nie","Nin","Ning", "Niu","Nong","Nu","Nv","Nuan","Nue","Nuo","O","Ou","Pa","Pai","Pan", "Pang","Pao","Pei","Pen","Peng","Pi","Pian","Piao","Pie","Pin","Ping","Po", "Pu","Qi","Qia","Qian","Qiang","Qiao","Qie","Qin","Qing","Qiong","Qiu","Qu", "Quan","Que","Qun","Ran","Rang","Rao","Re","Ren","Reng","Ri","Rong","Rou", "Ru","Ruan","Rui","Run","Ruo","Sa","Sai","San","Sang","Sao","Se","Sen", "Seng","Sha","Shai","Shan","Shang","Shao","She","Shen","Sheng","Shi","Shou","Shu", "Shua","Shuai","Shuan","Shuang","Shui","Shun","Shuo","Si","Song","Sou","Su","Suan", "Sui","Sun","Suo","Ta","Tai","Tan","Tang","Tao","Te","Teng","Ti","Tian", "Tiao","Tie","Ting","Tong","Tou","Tu","Tuan","Tui","Tun","Tuo","Wa","Wai", "Wan","Wang","Wei","Wen","Weng","Wo","Wu","Xi","Xia","Xian","Xiang","Xiao", "Xie","Xin","Xing","Xiong","Xiu","Xu","Xuan","Xue","Xun","Ya","Yan","Yang", "Yao","Ye","Yi","Yin","Ying","Yo","Yong","You","Yu","Yuan","Yue","Yun", "Za", "Zai","Zan","Zang","Zao","Ze","Zei","Zen","Zeng","Zha","Zhai","Zhan", "Zhang","Zhao","Zhe","Zhen","Zheng","Zhi","Zhong","Zhou","Zhu","Zhua","Zhuai","Zhuan", "Zhuang","Zhui","Zhun","Zhuo","Zi","Zong","Zou","Zu","Zuan","Zui","Zun","Zuo" }; #endregion 拼音编码 };
以上获得 汉字的全拼
二、部署(配置数据库连接)
或者在查询分析器中执行注册语句
--注册程序集 CREATE ASSEMBLY Proc_GetAllPY from 'E:\程序集存储过程\Proc_GetAllPY\Proc_GetAllPY\bin\Debug\Proc_GetAllPY.dll' WITH PERMISSION_SET = SAFE GO --创建存储过程 CREATE PROCEDURE Proc_GetAllPY(@hz nvarchar(1000),@py nvarchar(1000) out) AS EXTERNAL NAME Proc_GetAllPY.StoredProcedures.P_GetAllPY GO --开启clr支持 EXEC sp_configure 'clr enabled', 1 GO RECONFIGURE GO --执行存储过程 declare @str nvarchar(1000) exec dbo.Proc_GetAllPY '王燕飞' ,@str out select @str --关闭clr支持 EXEC sp_configure 'clr enabled', 0 GO RECONFIGURE GO
发表评论
-
C#生成唯一值的方法
2015-07-09 11:19 4040使用1、MaxId表存储各表的MaxId值 专门一个 ... -
sql 生成(c#model类)代码的存储过程
2015-05-09 18:57 804GO /****** 对象: StoredProcedu ... -
C#校验sql是否合法,不去执行sql语句
2015-04-17 10:10 1285public bool ValidateSQL(string ... -
sqlserver in 和Exists 用法
2013-12-13 14:12 1631例子如下(即exists返回where后2个比较的wher ... -
Win8安装SQL Server 2008“性能计数器注册表配置单元一致性”失败的解决办法
2013-12-02 23:19 1275在进行数据库安装检测时总是有一点通不过,提示“性能计数器注册 ... -
sql to xml
2013-04-18 14:52 761SQL Server FOR XML PATH 语句的应用 ... -
判断两个时间交叉
2012-02-23 14:44 2034SQL中常常要判断两个 ... -
sql生成流水号
2012-02-23 12:41 1858--思路:将表某一字段的默认值设置成自定义函数,该自定义 ... -
Sql存储过程分页性能
2011-12-29 13:36 843在项目中,我们经常遇到或用到分页,那么在大数据量(百万级以上) ... -
sql优化
2011-12-22 11:28 792(1) 选择最有效率的 ... -
sqlserver数据库镜像
2011-12-20 09:58 1005附件 -
提高sql性能
2011-08-04 12:36 756从 INSERT 返回 IDENTITY 我决定从遇到许 ... -
查询表主键sql
2010-09-01 16:41 17331:利用SQL自带的存储过程 EXEC sp_pkeys ... -
根据汉字获取拼音
2010-08-17 15:10 1237create function [dbo].[fGetPy]( ... -
自增号
2010-07-16 17:40 9741: 自增列 类型为:int identity(1,1) 当然 ... -
收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 SQL中的CASE使用方法【转】
2010-05-26 14:48 781Case具有两种格式。简单Case函数和Case搜索函数。 ... -
跨数据库触发器
2010-04-22 17:30 2101可以运用这条语句 select * from OPEND ... -
获取拼音首字母
2010-02-04 17:37 967create function fun_getPY(@str ... -
测试proc
2010-01-06 22:07 898Create proc Pro_TGWTOByQSF as ... -
sql 相当于split的函数
2010-01-06 21:59 1196create function Fnsplit(@Sou ...
相关推荐
首先,让我们深入了解一下如何在SQL Server 2005中创建CLR存储过程。创建过程分为几个步骤: 1. 准备环境: - 确保你有一个SQL Server 2005实例,并且启用了CLR集成。默认情况下,SQL Server 2005安装时会启用CLR...
SQL Server 2005中的CLR(Common Language Runtime)集成是一项强大的特性,它允许开发人员使用.NET Framework(如C#、Visual Basic .NET或Visual C++)编写的代码与SQL Server进行深度集成。这一功能扩展了数据库的...
CLR集成是SQL Server 2005中的一项重要创新,它将.NET Framework引入到数据库引擎内部,使得数据库开发者可以利用.NET的强大功能。通过CLR,我们可以创建更高效、更安全、更易维护的数据库对象,这些对象可以直接在...
SQL Server 2005中的CLR(Common Language Runtime)是一个重要的功能,它允许开发者使用.NET Framework的编程语言,如C#、Visual Basic .NET或F#,来编写存储过程、触发器、用户自定义函数(UDFs)、类型和聚合等...
#### 二、使用C#编写SQL Server 2005中的存储过程 - **存储过程概述**:存储过程是在数据库上创建的一组预编译的SQL语句。它们可以接受输入参数,执行复杂的操作并返回结果。使用C#编写存储过程可以使开发者充分...
这些类型使得开发者能够使用.NET Framework的语言,如C#或Visual Basic .NET,来创建和操作SQL Server的对象,如存储过程、函数、触发器等。CLR集成是SQL Server的一个特性,允许将.NET代码嵌入到数据库中,从而扩展...
在SQL Server中,CLR集成允许开发者使用.NET Framework的语言(如C#或VB.NET)编写存储过程、触发器和其他数据库对象,从而提升性能和功能。 描述中提到的“部署查看Windows SQL服务器报表”是指在Windows环境下...
在SQL Server中创建一个能够处理ZIP压缩和解压缩的CLR存储过程,我们需要遵循以下步骤: 1. **开发.NET项目**:使用Visual Studio或其他.NET IDE创建一个新的类库项目。在项目中,我们可以引入System.IO....
使用CLR存储过程,可以实现T-SQL难以完成的任务,例如调用.NET Framework的高级算法库,处理XML数据,或者执行图形和加密操作。这大大提高了SQL Server的可扩展性和灵活性。 总结来说,SQL Server 2005中的CLR集成...
SQL Server的CLR集成允许用户使用.NET编程语言(如C#或VB.NET)编写存储过程、触发器、函数等数据库对象。SQLSysClrTypes库则包含了处理这些对象所必需的类型和接口,例如,它可以处理空间数据类型,这对于地理信息...
标签“systemclrtypes”和“sqlserver2012”进一步明确了该压缩包的内容,System CLR Types是与SQL Server 2012紧密相关的库。System CLR Types在SQL Server中扮演着重要角色,它提供了对SQL Server高级功能的支持,...
在SQL Server 2005中,DTS被SSIS(SQL Server Integration Services)所取代,SSIS是更强大、更灵活的数据集成工具,能够处理复杂的ETL(提取、转换、加载)工作流。尽管如此,为了确保与早期版本的兼容性,SQL ...
在SQL Server中,CLR集成允许开发者使用.NET Framework的全部功能来编写存储过程、用户定义的函数、用户定义的类型、触发器和聚合函数。这样做的好处包括: 1. **性能提升**:对于需要大量计算的任务,使用CLR可以...
接下来,我们需要在Visual Studio 2005中创建一个新的SQL Server项目。选择“文件”->“新建项目”,在“新建项目”对话框中选择“Visual C#”下的“Database”,然后选择“SQL Server 项目”。根据向导选择或创建一...
CLR存储过程是用.NET语言编写的可执行代码,可以直接在SQL Server中执行,替代传统的Transact-SQL存储过程。它们提供了更好的性能、更高的安全性和更复杂的业务逻辑处理能力。 4. **用户定义函数(UDF)** CLR ...
通过以上步骤,我们可以使用C#在SQL Server 2005中创建存储过程。这种方式不仅提高了代码的可读性和维护性,还利用了.NET框架的强大功能,如类型安全、实时编译等。此外,CLR集成还支持创建其他数据库对象,如用户...
SQL Server CLR(Common Language Runtime)是微软SQL Server数据库引擎中的一个功能,允许开发人员使用.NET Framework的任何语言(如C#、VB.NET或F#)编写存储过程、触发器、用户定义函数(UDFs)、类型和其他...