MSSQL sys.partitions Crash

leo_paris posted 3 years ago in General

MSSQL Version 8.0.760

On HeidiSql the count rows fonction was :
And worked.

Since HeidiSql 8.2...
it uses :
SELECT object_name(object_id) AS tablename, SUM(rows) AS rows
FROM sys.partitions
index_id IN (0, 1)
AND object_name(object_id) IS NOT NULL
GROUP BY object_id
ORDER BY tablename

Witch may be faster but makes Crash HeidiSql on MSSQL 8.0.760

Will there be a workaround on this ?

Thanks !
ansgar posted 2 years ago
Ok, so if it's ok to use SELECT COUNT(*) on all versions then I would prefer to do so. Any performance issues on larger tables?
leo_paris posted 2 years ago

Yes may be I did not run tests on Big tables for now.

But I thinks it's better to have a function witch works with all version for now.
Else You would need a table of versions with compliant fonctions ...

I'll try to run some test with count(*) on small to big tables and send you the results.
ansgar posted 2 years ago
Perfect. Thanks for your feedback!
slestak989 posted 2 years ago

Perfect. Thanks for your feedback!


Do you know if this was ever schedule to be implemented?
Unfortunately, I an still using MSSQL2000 and I hit this issue frequently.


Steve Romanow
ansgar posted 2 years ago
Should be finally fixed in r4941, by falling back to SELECT COUNT(*) on MSSQL 2000.
slestak989 posted 2 years ago
Close but getting a different exception.

/* SQL Error (170): Cannot use empty object or column names. Use a single space if necessary
Line 1: Incorrect syntax near ''. */
ansgar posted 2 years ago
For me that worked, but it seems that MSSQL 2k wants the database name, not the schema name here. Should be fixed in r4942.
slestak989 posted 1 year ago
Think we're getting closer. I noticed when you did the select top 1000 you used two periods, and no error. One period is still abending.

I do not know Delphi, but can you catch the exception and just continue?

See attached screenshot.
1 attachment(s):
  • 2015-04-29-11_23_37-GLPI-Tickets
ansgar posted 1 year ago
Ok, so what is "element_prod" - a database or a schema?

I am blindly fixing things, as I don't have a MSSQL 8 server here.
slestak989 posted 1 year ago
It is the name of a db, and also the name of a user. I am not sure which it is expecting. I believe it is referencing for the db user.table? The owner of the tables is a user dbo.
slestak989 posted 1 year ago
No worries on the iterations. I'm just happy you haven't told me to deal with it and upgrade. We should be getting out of mssql 2k this year.

Please login to leave a reply, or register at first.