文章分类 - SQLServer
摘要:fromhttp://v-consult.be/2011/05/26/recover-sa-password-microsoft-sql-server-2008-r2/When you are using MS SQL Server in mixed mode, it is very importa...
阅读全文
摘要:from http://technet.microsoft.com/zh-CN/library/ms180971可以使用 TOP 子句来限制 UPDATE 语句中修改的行数。当 TOP (n) 子句与 UPDATE 一起使用时,将针对随机选择的 n 行执行删除操作。例如,假设您要为一位高级销售人员减...
阅读全文
摘要:转自 http://blog.csdn.net/hliq5399/article/details/8315373今天用到sql server 的xml字段,首先这个项目中的xml字段都存为了ntext字段,所以第一个操作 ntext 转化为 xml以下摘自http://blog.darkthread...
阅读全文
摘要:SQLServer:函数subString有三个参数,帮助文档中给出这三个参数的意义,如下:startingLoc 子字符串在资源字符串中的起点。如果此值为负数或 0,则只返回那些所在位置大于零的字符。如果此值大于 $sourceString 的长度,则返回...
阅读全文
摘要:获取数据库中用户表信息1、获取特定库中所有用户表信息select * from sys.tables select * from sys.objects where type='U' --用户表 第二条语句中当type='S'时是系统表2、获取表的字段信息select * from sys.co...
阅读全文
摘要:转自http://www.cnblogs.com/xwdreamer/archive/2012/08/28/2660151.html参考文献Monitoring with SQL ProfilerReadTrace在sql server中有一个profiler的工具用于追踪sql server的执行...
阅读全文
摘要:fromhttp://msdn.microsoft.com/en-us/library/ms189050.aspxRow versioning is a general framework in SQL Server that is used to do the following:Build th...
阅读全文
摘要:转自http://blog.itpub.net/13651903/viewspace-1082730/-----------------------1dbcc trraceon DBCC TRACEOFF--对于数据库死锁,通常可以通过TRACE FLAG 1204、1205、1206,检查ERRO...
阅读全文
摘要:转自http://www.cnblogs.com/xwdreamer/archive/2012/07/30/2615357.html在SQL Server标准的已提交读(READ COMMITTED)隔离级别下,一个读操作会和一个写操作相互阻塞。未提交读(READ UNCOMMITTED)虽然不会有...
阅读全文
摘要:from http://sqlfool.com/2010/02/filtered-indexes-work-around/Recently, I needed to create a stored procedure that queried a rather large table. The ta...
阅读全文
摘要:--聚合函数和排名函数都支持OVER()子句--注意区别聚合函数和GROUP BY组合的分组统计SELECTorderid,custid,val,SUM(val)OVER()AStotalvalueFROMSales.OrderValues;10248 85 440.00 1265793.221...
阅读全文
摘要:GROUP BYgroups the result set into summary rows by provided columns. For example, consider below data which contains sales figures by region.GroupName...
阅读全文
摘要:By usingGROUPING SETS()we can specify multiple groupings in a single query.GROUPING SETS()generates the result by producing aUNION ALLset of the resul...
阅读全文
摘要:from http://blog.sqlauthority.com/2009/11/19/sql-server-understanding-table-hints-with-examples/IntroductionToday we have a very interesting subject t...
阅读全文
摘要:SQL Server 2005 introduced ROW_NUMBER() which provided an easy option to implement server side paging. SQL Server 2012 added another enhancement which...
阅读全文
摘要:from http://www.sqlserverspecialists.com/2013/03/database-related-dynamic-management.htmlDatabase Related Dynamic Management ViewsNOTE:For SQL Server ...
阅读全文
摘要:from http://www.sqlserverspecialists.com/2013/03/os-related-to-sql-server-dynamic.htmlThe following SQL Server Operating System related dynamic manage...
阅读全文
摘要:from http://www.sqlserverspecialists.com/2013/03/execution-thread-related-sql-server.htmlThese DMVs and functions show what activity is executing on t...
阅读全文
摘要:from http://www.sqlserverspecialists.com/2013/03/transaction-related-dynamic-management.htmlsys.dm_tran_active_snapshot_database_transactionsReturns a...
阅读全文
摘要:from http://www.sqlserverspecialists.com/2013/03/common-language-runtime-related-dynamic.htmlUseful for understanding and troubleshooting CLR objects ...
阅读全文