易截截图软件、单文件、免安装、纯绿色、仅160KB

sql server 系统函数用法实例

系统函数
1.case when ... then ..else ..end(用于对条件进行测试)
e.Select id,case when name='deepwishly' then '老大' else '其他' end as Type
 显示 id  type
          1   老大
2.cast()/convert() 前者具有ANSI SQL-92兼容性,后者功能更强大
e, cast(variable_or_column As datatype);convert(datatype,varialbe_or_column)
3.isdate()判断是否是有效的日期或时间,测试日期格式必须与使用 set dateformat or set language设定的格式具有相同的地域格式
e, select isdate(varialbe_or_column)//是有效日期返回1否则返回0
4.isnull() 判断是否是null
isnull(value_to_test,new_value)
e,替换数据库或变量中null为某值,select isnull(variable_or_column,new_value)
5.isnumeric()判断是否是数字 返回0,false或1,true
e,select(variable_or_colunn)


相关文档:

SQL Server中Rollup关键字使用技巧

首先创建测试表、添加数据。
create table #t(a int,b int,c int,d int,e int)
insert into #t values(1,2,3,4,5)
insert into #t values(1,2,3,4,6)
insert into #t values(1,2,3,4,7)
insert into #t values(1,2,3 ......

sql server 2005 用户权限

要想成功访问 SQL Server 数据库中的数据,我们需要两个方面的授权:一、获得准许连接 SQL Server 服务器的权利;二、获得访问特定数据库中数据的权利(select, update, delete, create table ...)。假设,我们准备建立一个 dba 数据库帐户,用来管理数据库 mydb。
1. 首先在 SQL Server 服务器级别,创建登陆帐户(creat ......

[SQL Server] 存储过程事务

在存储过程中使用事务,以下为模板:
CREATE PROCEDURE testPro
AS
/**//* ------- 事务开始---------- */
BEGIN TRANSACTION tran_test
/**//* -------- 保存事务----------*/
SAVE TRANSACTION tran_test
/**//* -------- 数据操作---------*/
INSERT [table1] ( [content] ) VALUES ( '43332' )
/**//*---- ......

Sql Server convert日期转换函数应用

Sql Server 中一个非常强大的日期格式化函数
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(100), GE ......

How To Use Dynamic Sql in Sql Server ?

How To Use Dynamic Sql in Sql Server ?
 
动态SQL 在sql server Procedure中的应用
 
 
Create PROCEDURE [dbo].[Proc_Get_Serial_No]
        (
         @Table_Name varchar(20),
      ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号