摘要:
server数据库中raiserror的作用就和asp.NET中的throw new Exception一样,用于抛出一个异常或错误。这个错误可以被程序捕捉到。 raiserror的常用格式如下:raiserror('错误的描述',错误的严重级别代码,错误的标识,错误的描述中的参数的值(这个可以是多 阅读全文
摘要:
在SQL Server 的使用过程中,发现几个很有用,但不太常用(或细节不太清楚)的函数(存储过程): isnumeric,isdate,patindex,newid,collate,sp_executesql,checksum 遂记下,以备日后查询。不敢独享,与君共之。有用且看,无用略过。 1> 阅读全文
摘要:
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 阅读全文
摘要:
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, ' 阅读全文
摘要:
生成测试表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 阅读全文
摘要:
http://blog.csdn.net/roy_88/article/details/3020586 阅读全文
摘要:
A. 使用带有 CASE 简单表达式的 SELECT 语句Using a SELECT statement with a simple CASE expression在 SELECT 语句中,CASE 简单表达式只能用于等同性检查,而不进行其他比较。 下面的示例使用 CASE 表达式更改产品系列类别 阅读全文