摘要: server数据库中raiserror的作用就和asp.NET中的throw new Exception一样,用于抛出一个异常或错误。这个错误可以被程序捕捉到。 raiserror的常用格式如下:raiserror('错误的描述',错误的严重级别代码,错误的标识,错误的描述中的参数的值(这个可以是多 阅读全文
posted @ 2017-04-02 19:39 覆雨翻云 阅读(22634) 评论(1) 推荐(3) 编辑
摘要: 在SQL Server 的使用过程中,发现几个很有用,但不太常用(或细节不太清楚)的函数(存储过程): isnumeric,isdate,patindex,newid,collate,sp_executesql,checksum 遂记下,以备日后查询。不敢独享,与君共之。有用且看,无用略过。 1> 阅读全文
posted @ 2017-04-02 19:36 覆雨翻云 阅读(495) 评论(0) 推荐(0) 编辑
摘要: pivot 与 unpivot 函数是SQL05新提供的2个函数 灰常灰常的实用 pivot函数: create table test(id int,name varchar(20),quarter int,profile int)insert into test values(1,'a',1,10 阅读全文
posted @ 2017-04-02 18:43 覆雨翻云 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 2005的行列转换: create table ta(编号 int,人员 varchar(5), 年份 int,月份 int ,[1号] varchar(5), [2号] varchar(5),[3号] varchar(5),[4号] varchar(5))insert ta select 1, ' 阅读全文
posted @ 2017-04-02 18:36 覆雨翻云 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 生成测试表Tif exists(select 1 from sysobjects where Name=N'T' and objectProperty(ID,N'IsUserTable')=1) drop table Tgoselect top 5 ID,Name into T from sysob 阅读全文
posted @ 2017-04-02 18:28 覆雨翻云 阅读(271) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/roy_88/article/details/3020586 阅读全文
posted @ 2017-04-02 18:18 覆雨翻云 阅读(2932) 评论(0) 推荐(1) 编辑
摘要: A. 使用带有 CASE 简单表达式的 SELECT 语句Using a SELECT statement with a simple CASE expression在 SELECT 语句中,CASE 简单表达式只能用于等同性检查,而不进行其他比较。 下面的示例使用 CASE 表达式更改产品系列类别 阅读全文
posted @ 2017-04-02 18:16 覆雨翻云 阅读(325) 评论(0) 推荐(0) 编辑