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

SQL SERVER 函数(转)

SQLServer基本函数
1.字符串函数 :
字符操作类 :
upper(char_expr) 转为大写
lower(char_expr) 转为小写
UCase(string) 返回 Variant (String),其中包含转成大写的字符串。
LCase(string) 返回字符串的小写形式。
space(int_expr) 生成int_expr个空格
replicate(char_expr,int_expr) 复制字符串int_expr次
reverse(char_expr) 反转字符串
stuff(char_expr1,start,length,char_expr2) 将字符串char_expr1中的从 start开始的length个字符用char_expr2代替
ltrim(char_expr) rtrim(char_expr) 去掉空格
ascii(char) char(ascii) 两函数对应,取ascii码,根据ascii吗取字符
字符串查找 :
charindex(char_expr,expression) 返回char_expr的起始位置
patindex("%pattern%",expression) 返回指定模式的起始位置,否则为0
locate(substr,str,pos) 返回子串substr在字符串str第一个出现的位置
2.数学函数
abs(numeric_expr) 求绝对值
ceiling(numeric_expr) 取大于等于指定值的最小整数
exp(float_expr) 取指数
floor(numeric_expr) 小于等于指定值得最大整数
power(numeric_expr,power) 返回power次方
rand([int_expr]) 随机数产生器
round(numeric_expr,int_expr) 安int_expr规定的精度四舍五入
sign(int_expr) 根据正数,0,负数,,返回+1,0,-1
sqrt(float_expr) 平方根
exp(float x):求e的x次幂
tan(float x):计算x(弧度表示)的正切值。
atan(float x):求x(弧度表示)的反正切值
cos(float x):求x(弧度表示)的余弦值
acos(float x):求x(弧度表示)的反余弦值
sin(float x):计算x(弧度表示)的正弦值。
asin(float x):求x(弧度表示)的反正弦值
fabs(float x):求浮点数x的绝对值
fmod(float x, float y):计算x/y的余数
pow(float x, float y):计算x的y次幂。
sqrt(float x):计算x的平方根。
3.日期,时间函数
getdate() 返回日期
datename(datepart,date_expr) 返回名称
datepart(datepart,date_expr) 取日期一部份
datediff(datepart,date_expr1.dateexpr2) 日期差
dateadd(datepart,number,date_expr) 返回日期加上 number
4.系统函数
suser_name() 用户登录名
user_name() 用户在数据库中的名字
user 用户在数据库中的名字
show_role() 对当前用户起作用的规则
db_name() 数据库名
object_name(obj_id) 数据库对象名
col_name(obj_id,col_id) 列名
col_le


相关文档:

c# SQL数据库远程连接及配置方法

c# SQL数据库远程连接及配置方法
一:C# 连接SQL数据库
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
Server=myServerAddress;D ......

c# SQL数据库远程连接及配置方法

首先配置SQLSERVER2005:
打开”Microsoft SQL Server Management Studio“ 直接用Windows 用户连接进入,再在“安全性”中的“登录名”内的“新建登录名”,你就对应的添好“确定”就可以了。  
再在你对应的“数据库”里“安全性” ......

防止sql注入 适用于 URL ID 纯数字

例子:  int id = Convert.ToInt32(replace((Request.QueryString["id"]), ""));
    public static string replace(string str, string str2)
    {
        str = str.Replace(";", str2);
        str = ......

(网摘)SQL分页语句


之前偶然逛网页的时候看到的,详细的网址忘记copy过来了,真是抱歉。觉得简单易懂,所以转了,嘻嘻
有关分页 SQL 的资料很多,有的使用存储过程,有的使用游标。本人不喜欢使用游标,我觉得它耗资、效率低;使用存储过程是个不错的选择,因为存储过程是经过预编译的,执行效率高,也更灵活。先看看单条 SQL 语句的分页 SQL ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号