月份处理及SQL时间条件instr函数
YearCode:=yearof(Date);
MonthCode:=monthof(Date);
if MonthCode>9 then
FTime1:=inttostr(YearCode)+inttostr(MonthCode)
else
FTime1:=inttostr(YearCode)+'0'+inttostr(MonthCode);
FTime:= DateTimeToStr(Date); //
//FTime1:=formatdatetime('yyyymm',Date);
//FTime1:=leftstr(FTime,6);
TimeTemp:=formatdatetime('yyyy-mm',Date);
cds.Active:=false;
cds.CommandText:='select /*+index(a,TAB1_I)*/ max(a.id) as id from TAB1 a where '
+'INSTR(a.id,'''+FTime1+''', 1,1 )>0 and length(a.id)=11 and a.UPDATE_TIME between '
+' to_date('''+TimeTemp+'-01 00:00:00'',''yyyy-mm-dd hh24:mi:ss'') '
+' and to_date('''+FTime+''',''yyyy-mm-dd hh24:mi:ss'') ' ;
cds.Active:=true;
相关文档:
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列
......
declare @id varchar(10)
declare @nm varchar(10)
declare @table as table(emp varchar(10),empname varchar(10))
declare CurEmp cursor for select top 6 empid,empname from employee
open CurEmp
fetch next from CurEmp into @id,@nm
While @@fetch_status=0
begin
insert @table(emp,e ......
2.根据Oracle 数据库scott 模式下的emp 表和dept 表,完成下列操作:
(1) 查询20号部门的所有员工信息;
(2) 查询所有工种为CLERK 的员工的员工号、员工名和部门号;
(3) 查询奖金COMM 高于工资SAL 的员工信息;
  ......
最近为数据库服务器增加了内存,达到了最大支持的8G,数据库用的是mssql 2005 ,之前内存一直是4G的,不存在内存大和32位操作系统冲突的事情,32位操作系统单进程最大支持2G的内存,这样子的话内存就白加了,怎么办呢?
网上搜索了很多资料,发现微软提供了一个算是临时的解决方案吧,使用AWE来分配内存,这样子sqlse ......
MS-SQL中sa登录失败:
该错误产生的原因是由于SQL Server使用了"仅 Windows"的身份验证方式,
因此用户无法使用SQL Server的登录帐户(如 sa )进行连接.解决方法如下所示:
1.在服务器端使用企业管理器,并且选择"使用 Windows 身份验证"连接上 SQL Server
操作步骤:
在企业管理器中
--右键你的服务器实例(就是那 ......