摘要: function fn-GetLineCount ($FilePath){ $nlines = 0; gc $FilePath -read 1000 | % { $nlines += $_.Length }; [string]::Format("{0} has {1} lines", $FilePa 阅读全文
posted @ 2017-02-02 13:58 BI-Info 阅读(2603) 评论(0) 推荐(0) 编辑
摘要: After installing SQL server on a machine, it happens that you connect or disconnect that machine to domain. WHen you do this, the administrator accoun 阅读全文
posted @ 2017-01-13 16:54 BI-Info 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 物理表 IF OBJECT_ID('dbo.Scores', 'U') IS NOT NULL DROP TABLE dbo.Scores; 临时表 IF OBJECT_ID('tempdb.dbo.#T', 'U') IS NOT NULL DROP TABLE #T; SQL Server 2016 新加功能 DROP TABLE IF EXISTS dbo.Scores 阅读全文
posted @ 2017-01-12 16:22 BI-Info 阅读(1803) 评论(0) 推荐(0) 编辑
摘要: At the top level there are mainly 3 types of joins: INNEROUTERCROSS INNER JOIN - fetches data if present in both the tables.OUTER JOIN are of 3 types: 阅读全文
posted @ 2017-01-11 11:34 BI-Info 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 方法1: 单表 方法2: 适用于多表 阅读全文
posted @ 2017-01-10 18:24 BI-Info 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 在SQL Server中我们可以把一个表的数据通过 select 插入到另一个表中,比如: INSERT INTO Table (col, col2, col3) SELECT col, col2, col3 FROM other_table WHERE sql = 'cool' 那有没有办法通过select去更新另一个表呢? 比如有一个临时表包含有我需要的值,我需要通过它去更新另外一个表。 在S... 阅读全文
posted @ 2017-01-09 09:25 BI-Info 阅读(7634) 评论(0) 推荐(1) 编辑
摘要: Is there any way in which I can clean a database in SQl Server 2005 by dropping all the tables and deleting stored procedures, triggers, constraints and all the dependencies in one SQL statement? REAS... 阅读全文
posted @ 2017-01-05 14:20 BI-Info 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 1. 使用输出变量 2. 使用临时表 阅读全文
posted @ 2017-01-04 09:48 BI-Info 阅读(1221) 评论(0) 推荐(0) 编辑
摘要: 我们经常在SQL Server列中存一些XML来作为配置文件或者是保存特殊信息,那么如何将其展开并查询它或将其呈现为关系数据? 其实在T-SQL 下可以很容易的实现。 示例xml 我们先把xml插入到一个临时表中,只有两个字段ConfigName和ConfigXML 好的,下面来看一下场景是如何用s 阅读全文
posted @ 2017-01-03 09:36 BI-Info 阅读(915) 评论(0) 推荐(0) 编辑
摘要: 如果SQL query中有参数,SQL Server 会创建一个参数嗅探进程以提高执行性能。该计划通常是最好的并被保存以重复利用。只是偶尔,不会选择最优的执行计划而影响执行效率。 SQL Server尝试通过创建编译执行计划来优化你的存储过程的执行。通常是在第一次执行存储过程时候会生成并缓存查询执行计划。当SQL Server数据库引擎编译存储过程中侦测到有参数值传递进来的时候,会创建基于这些参数... 阅读全文
posted @ 2016-12-30 08:45 BI-Info 阅读(1872) 评论(0) 推荐(0) 编辑