设为首页 加入收藏

TOP

最近工作中遇到的SQL语句
2015-11-21 02:07:52 来源: 作者: 【 】 浏览:0
Tags:最近 工作 遇到 SQL 语句

1.求表中某列的和,并把其值赋给一个变量:

?

SqlCommand cmd = new SqlCommand( "select sum(aa) from table ", conn); 

Int32 aa= (Int32) cmd.ExecuteScalar(); 

2.判断字段的值是否为数字

?

?

select * from hr_user where isnumeric(usid)=1//为数字
select * from hr_user where isnumeric(usid)=0//不为数字

3.数据表Rex_Test3中 字段【UserName】中 包含 字符【R】 的数据集
select * from Rex_Test3 where charindex('R',UserName)>0

数据表Rex_Test3中 字段【UserName】中 不包含 字符【R】 的数据集
select * from Rex_Test3 where charindex('R',UserName)=0

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇oracle中使用impdp数据泵导入数据.. 下一篇sqlite操作

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: