去年无聊的时候想到想玩一下根据ASCII表的排列顺序将字符串内的数值往前或者后移N个位,顺便看一下是T-SQL性能好还是用C#写CLR函数处理得快.结果是在50万行以下其实两者差距很小,当然这是在我的笔记本上测试的结果(I5双核四线程+8G内存+5600转的机械硬盘).在100万行以上的时候用T-SQL基于集合的方式就体现出优势了,用了大概1分多钟就处理完100万行,而CLR用了4分多钟还没处理完.这里贴上当时的T-SQL代码. if OBJECT_ID('tempdb..#tt') is no…
create proc insertLog@Title nvarchar(50),@Contents nvarchar(max),@UserId int,@CreateTime datetimeasinsert into Logs values(@Title,@Contents,@UserId,@CreateTime)goexec insertLog 'admin','admin',1,'2018-11-19' 看一下存储过程的定义: 存储过程就是一组为了完成特定功能的SQL 语句集,存储在数据…
今天在修改一个字段类型,由原来的 varchar(500) 增加到 varchar(1000) 则对应的SQL 语句,执行后如图错误 结果查下来是因为其中一个视图建成了索引视图, 解决办法:先将该视图删除,执行修改字段的语句,再创建视图 该视图增加 with schemabinding…
当数据库有数据修改数据库字段时,默认是阻止的! 工具---选项---设计器---阻止保存要求重新创建表的更改(取消钩)…
Problem One task that you may need to do as a DBA is to move the system databases from one location to another.  The documentation that is found on the Microsoft site is helpful, but the steps are more geared toward moving one database at a time.  In…
Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful with trace flags, test in your test environment first. And consult professionals first if you are the slightest uncertain about the effects of your cha…
http://sqlserverbuilds.blogspot.jp/   What version of SQL Server do I have? This unofficial build chart lists all of the known Service Packs (SP), Cumulative Updates (CU), patches, hotfixes and other builds of MS SQL Server 2016, 2014, 2012, 2008 R2,…
https://www.simple-talk.com/sql/t-sql-programming/consuming-json-strings-in-sql-server/ Consuming JSON Strings in SQL Server 15 November 2010 by Phil Factor   Updated 2nd May 2013 Updated 8th  May 2014 It has always seemed strange to Phil that SQL Se…
原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Service Packs (SP), Cumulative Updates (CU), patches, hotfixes and other builds of MS SQL Server 2014, 2012, 2008 R2, 2008, 2005, 2000, 7.0, 6.5 and 6.0 tha…
原文地址: http://bbs.51cto.com/thread-458009-1-1.html   引用: 摘要 本文介绍了SQL Server 2005能够支持的XQuery的各方面特性如FLWOR语句,XQuery的操作,if-then-else结构,XML的构造函数,XQuery的内置函数,类型的转换操作符,并举例说明了上述XQuery功能的应用和操作.本文同时也对SQL Server 2005所不能支持的XQuery的特性进行了分析讨论,并提出了实际工作中的解决方案.在本文的最后章节…