對數字字符串進行排序

未排序前字符串Fcode列表如下:

 

在sql server 2008用以下命令排序

SELECT [fID]
      ,[fParentID]
      ,[fParentCode]
      ,[fCode]
      ,[fName]
      ,[fNotes]
  FROM [ClothingTem].[dbo].[tProductType]  where fParentCode=''  order by cast(fCode as int)

結果如下:

 

在delphi xe 10.3中運行設置如下:

  qbaseinfo.SQl.Clear;
   qbaseinfo.SQl.Text:='SELECT  * FROM [ClothingTem].[dbo].[tProductType]  where fParentCode='''+'''   order by cast(fCode as int)' ;
      if qbaseinfo.Active=false then  qbaseinfo.Active:=true;

結果如上圖

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章