用什么开发呀?
什么数据库?********************************************
http://www.itpub.net 最专业的oracle讨论站点

解决方案 »

  1.   


    var 日期变量:date
    var 日序号:integer
    begin
      日期变量:=3000。1。1
      日序号:=0
      打开表
      按日期索引
      到头
      WHILE 没有到尾
        IF 表.日期=日期变量 THEN BEGIN
            日期变量:=表.日期
            日序号:=0
        END
        替换结果子断 WITH 字符串(日期变量)+数字字符串(日序号)
        日序号+1
        表移到下一个纪录
      END
      显示:"都做完了!"
    END      
      

  2.   

    以下是一个思路没有编译过,
    你将它放到一个存储过程中调试一下应该可以!declare @i int,@j int,@Name varchar(10),@time Datetime,@tmptime Datetime,@tmp varchar(11)
      set @i=1
      set @tmptime=getdate()+1
      declare xxx cursor for Select name,time from table1 order by time
      open xxx
    T_NEXT_NEW:
      fetch xxx into @name,@time
      if (@@fetch_status=0)
      begin
         if convert(char(8),@time,112)<>convert(char(8),@tmptime,112)
         begin
           set @tmptime=@time
           set @i=1
         end
         set @tmp=convert(char(8),@time,112)
         set @tmp=@tmp+'00'
         set @i=convert(int,@tmp)+@i
         select @name,@time, convert(char(11),@i) as '编号'
         goto T_NEXT_NEW
      end   
      close xxx 
      deallocate xxx
      

  3.   

    数字字符串(日序号)
    function strnum(x:integer,l:integer):string
    var i:integer;s:string;
    begin
      s:=inttostr(x);
      i:=length(s);
      result:=s+copy('0000000000000000',1,3-i)
    end
      

  4.   

      result:=s+copy('0000000000000000',1,3-i)
    改为
      result:=copy('0000000000000000',1,3-i)+s
      

  5.   

    function FileIndex(const mFileName: TFileName; mFieldName: string;
      mMinValue, mMaxValue: Integer; mChange: Boolean): Integer;
    var
      I: Integer;
    begin
      with TStringList.Create do try
        try
          if FileExists(mFileName) then LoadFromFile(mFileName);
          I := StrToIntDef(Values[mFieldName], 0);
          if (mMaxValue <> 0) and (I > mMaxValue) then I := mMinValue;
          if mChange then begin
            Values[mFieldName] := IntToStr(I + 1);
            SaveToFile(mFileName);
          end;
          Result := I;
        except
          Result := -1;
        end;
      finally
        Free;
      end;
    end; { FileIndex }//demo
    DateToStr(Date) + FloatFormat('000', FileIndex('Index.txt', DateToStr(Date), 1, 999, True));
      

  6.   

    上面那具错了!这个应该可以!
    以下是一个思路没有编译过,
    你将它放到一个存储过程中调试一下应该可以!declare @i int,@j int,@Name varchar(10),@time Datetime,@tmptime Datetime,@tmp varchar(11)
      set @i=1
      set @tmptime=getdate()+1
      declare xxx cursor for Select name,time from table1 order by time
      open xxx
    T_NEXT_NEW:
      fetch xxx into @name,@time
      if (@@fetch_status=0)
      begin
        if convert(char(8),@time,112)<>convert(char(8),@tmptime,112)
        begin
          set @tmptime=@time
          set @i=1
        end
        set @tmp=convert(char(8),@time,112)
        set @tmp=@tmp+'00'
        set @j=convert(int,@tmp)+@i
        select @name,@time, convert(char(11),@j) as '编号'
        set @i=@i+1
        goto T_NEXT_NEW
      end  
      close xxx 
      deallocate xxx
      

  7.   

    怎么到delphi版来了?
    其实一两条语句就可以搞定了。
    假设time是datetime 型,且精确到时分秒(可能会有重复):
    select identity(int,1,1) as id,convert(varchar,ftime,101) as ftime,fname
    into #temp from tablename  order by ftimeselect f1+replicate('0',3-len(cast(f2 as varchar)))+cast(f2 as varchar) fno
    ,fname
    from (
    select right(ftime,4)+left(ftime,2)+
    substring(ftime,4,2) f1,
    id +1-
    (
    select min(id) from #temp t1 
    where t1.ftime=t2.ftime) f2,fname from #temp t2
    ) t3
    order by f1,f2若time字段没有重复,就只一条语句就可以搞定了,写法可以自己想想:)