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

在sql server中关于游标cursor的使用

--此处使用pubs库
declare @myname varchar(50)
declare @fname varchar(20)
declare @lname varchar(20)
declare my_cursor cursor for
select fname,lname from employee order by emp_id
open my_cursor
fetch next from my_cursor into @fname,@lname
while @@fetch_status=0
begin
    set @myname=@fname+@lname
    fetch next from my_cursor into @fname,@lname
end
close my_cursor
deallocate my_cursor


相关文档:

[收拢] 用sqlite 执行标准 sql 语法

http://www.umgr.com/blog/PostView.aspx?bpId=36294
 1. 执行sql语句
int sqlite3_exec(sqlite3*, const char *sql, sqlite3_callbacksql 语法
, void *,  char **errmsg );
这就是执行一条 sql 语句的函数。
第1个参数不再说了,是前面open函数得到的指针。说了是关键数据结构。
第2个参数const char ......

sql索引类型

索引类型
唯一索引:唯一索引不允许两行具有相同的索引值
主键索引:为表定义一个主键将自动创建主键索引,主键索引是唯一索引的特殊类型。主键索引要求主键中的每个值是唯一的,并且不能为空
聚集索引(Clustered):表中各行的物理顺序与键值的逻辑(索引)顺序相同,每个表只能有一个
非聚集索引(Non-clustered):非聚 ......

SQL select

--desc 表名 描述表的内容  
desc emp;
--加上数学表达式和列名  ""保持格式
select ename "name space", sal*12 year_sal from emp;   
select 2*3 from dual;
select sysdate from dual;
--空值的数学表达式 结果都是空值
select ename, sal*12 + comm from emp;  
- ......

SQl SERVER 2000 遍历表中数据的方法

方法一:使用游标
declare @ProductName nvarchar(50)
declare pcurr cursor for select ProductName from Products
open pcurr
fetch next from pcurr into @ProductName
while (@@fetch_status = 0)
begin
print (@ProductName)
fetch next from pcurr into @ProductName
end
close pcurr
deallocate pcurr ......

SQL模糊查询语句(like)

确定给定的字符串是否与指定的模式匹配。模式可以包含常规字符和通配符字符。模式匹配过程中,常规字符必须与字符串中指定的字符完全匹配。然而,可 使用字符串的任意片段匹配通配符。与使用 = 和 != 字符串比较运算符相比,使用通配符可使 LIKE 运算符更加灵活。如果任何参数都不属于字符串数据类型,Microsoft SQL Server ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号