Order by Issues

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
SteveInIT
Posts: 9
Joined: Wed 22 Apr 2015 17:42

Order by Issues

Post by SteveInIT » Thu 07 Jan 2021 16:52

I am running Delphi 10.4 with Unidac 8.2.5

Table structure on MS SQL Server 2019 as follows showing data and structure

CREATE TABLE Inventory.dbo.AssetTypeTBL (
AssetTypeIDNo BIGINT IDENTITY
,AssetTypeName VARCHAR(50) NOT NULL
,AssetTypeDesc VARCHAR(50) NULL
,DateCreated DATETIME NOT NULL
,CONSTRAINT PK_AssetTypeTBL_AssetTypeIDNo PRIMARY KEY CLUSTERED (AssetTypeIDNo)
) ON [PRIMARY]
GO

CREATE INDEX IDX_AssetTypeTBL_AssetTypeName
ON Inventory.dbo.AssetTypeTBL (AssetTypeName)
ON [PRIMARY]
GO

Table Data-

AssetTypeIDNo AssetTypeName AssetTypeDesc DateCreated
1 Chromebook a chromebook 7/12/2019 1:42:38.117 PM
2 MacBook Pro Apple Laptop 7/5/2019 1:43:27.990 PM
3 IPad Apple Ipad 7/12/2019 2:07:00.543 PM
4 PC Tablet Android or Microsoft Device 7/12/2019 2:08:01.080 PM
5 PC Laptop (null) 7/12/2019 2:08:41.047 PM
6 PC Desktop (null) 7/12/2019 2:08:56.447 PM
7 Apple Desktop (null) 7/12/2019 2:09:16.833 PM
8 Apple TV 7/12/2019 2:14:50.110 PM
9 Projector (null) 7/12/2019 2:15:11.090 PM
10 Smartboard (null) 7/12/2019 2:15:40.900 PM
11 Interactive TV (null) 7/12/2019 2:15:57.583 PM
12 Network Switch (null) 7/12/2019 2:17:23.027 PM
13 CB Charger 65 watt For newer model Chromebooks 9/5/2019 1:08:05.983 PM
15 Monitor- LED Desktop (null) 10/16/2019 11:01:52.037 AM
17 Printer- Network Enterprise Level Printer 3/5/2020 12:00:00.000 AM
18 Printer Tray for Enterprise Printer 3/5/2020 10:50:20.430 AM
20 WAP - Indoor Wireless Access Point 9/28/2020 11:25:00.957 AM
21 WAP - Outdoor Wireless Access Point 9/28/2020 11:25:24.807 AM
22 Printer- AIO All-in-one 10/23/2020 12:30:18.093 PM
23 Cellular Hot Spot (null) 11/10/2020 12:00:00.000 AM
24 Webcam (null) 11/20/2020 12:00:00.000 AM
25 Document Camera (null) 1/5/2021 12:00:00.000 AM

TUniQuery SQL Text is as follows-

SELECT *
FROM AssetTypeTBL
ORDER BY AssetTypeName;

With index, without index, however I do it, it will not sort on AssetTypeName field. What am I doing wrong? Everything I find says I'm doing it correctly.

Thank you,

Steve

SteveInIT
Posts: 9
Joined: Wed 22 Apr 2015 17:42

Re: Order by Issues

Post by SteveInIT » Thu 14 Jan 2021 16:38

I was able to figure it out. There must be a bug someplace.

SQL is correct.

Deleted the TUniQuery associated with the AssetTypeTBL.

Re-created the TUniquery, Now, getting a Lookup Field error. Deleted the associate Lookup Fields in corresponding tables. Recreated the Lookup Fields.

Now everything is sorting as it should.

Thanks for at least reading :)

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Order by Issues

Post by Stellar » Mon 18 Jan 2021 15:24

Glad to see that the issue was resolved.
Feel free to contact us if you have any further questions about our products.

Post Reply