orale sql相关学习
to_date和to_char是oracle里里面的内置函数而不是标准的sql语法中的函数,用法举例:
1.to_char,返回结果可显示为各种形式
select to_char(sysdate,'yyyy/mm/dd') ,sysdate from dual;
结果: 2010/05/26 2010-5-26 17:09:33
2.to_date,转化为DATE型,返回结果形式只有一种
select to_date( '21/01/2002 18:02:23 ' , 'dd/mm/yyyy hh24:mi:ss' ),to_date( '21/01/2002 8:02:23 ' , 'dd/mm/yyyy hh:mi:ss PM' ) from dual;
结果: 2002-1-21 18:02:23 2002-1-21 8:02:23
相关文档:
本文章原创于www.yafeilinux.com 转载请注明出处。
接着上一篇教程。
二,在SQL语句中使用变量。
我们先看下面的一个例子,将“查询”按钮的槽函数更改如下:
void Widget::on_pushButton_clicked()
{
QSqlQuery query;
query.prepare(“insert i ......
添加、删除、修改使用
db.Execute(Sql)命令执行操作
╔----------------╗
☆ 数据记录筛选 ☆
╚----------------╝
注意:单双引号的用法可能有误(没有测式)
Sql = "Select
Distinct
字段名 from 数据表"
Distinct函数,查询数据库存表内不重复的记录
......
1、 存储过程
1) 尽量将代码段放到TRY…CATCH…。
但凡使用C#写过代码的人,都知道C#中TRY…CATCH…的运行和出错跳转逻辑,而SQL Server2005中,其运行和出错跳转逻辑与在C#中是一致的。TRY…CATCH…是SQL Server2005中新增的,功能强大,且很好用。
2)&nb ......
sql server 2005 简单运用函数
1.null 函数
用法与oracle中nvl()类似,处理函数为isnull(),
例如:
select ename,sal+isnull(comm,0)
from emp
go
isnull(comm,0)的用法是: comm为null 则返回0 否则为 comm的值。
2.V ......
如果你使用的是 SQL Server 2008, 当你修改数据结构后,保存时会报下图情况: Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving cha ......