MSSQL sys.partitions Crash

[expired user #7981]'s profile image [expired user #7981] posted 10 years ago in General Permalink
Hi,

MSSQL Version 8.0.760

On HeidiSql 8.1.0.4554 the count rows fonction was :
SELECT COUNT(*) FROM ."TABLE";
And worked.

Since HeidiSql 8.2...
it uses :
SELECT object_name(object_id) AS tablename, SUM(rows) AS rows
FROM sys.partitions
WHERE
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's profile image ansgar posted 10 years ago Permalink
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?
[expired user #7981]'s profile image [expired user #7981] posted 10 years ago Permalink
Hi,

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's profile image ansgar posted 10 years ago Permalink
Perfect. Thanks for your feedback!
[expired user #8855]'s profile image [expired user #8855] posted 9 years ago Permalink

Perfect. Thanks for your feedback!



Ansgar,

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

Thanks,

Steve Romanow
Code modification/commit from ansgarbecker, 9 years ago, revision 9.1.0.4941
Outsource RowCount into TDBObject which calls TDBConnection.GetRowCount with a server and version specific query. Introduce SELECT COUNT(*) for MSSQL 2000.
See
* http://www.heidisql.com/forum.php?t=18158
* http://www.heidisql.com/forum.php?t=15438
ansgar's profile image ansgar posted 9 years ago Permalink
Should be finally fixed in r4941, by falling back to SELECT COUNT(*) on MSSQL 2000.
[expired user #8855]'s profile image [expired user #8855] posted 9 years ago Permalink
Close but getting a different exception.

SELECT COUNT(*) FROM ""."ANALYSIS";
/* SQL Error (170): Cannot use empty object or column names. Use a single space if necessary
Line 1: Incorrect syntax near ''. */
Code modification/commit from ansgarbecker, 9 years ago, revision 9.1.0.4942
Use table schema only when not empty, otherwise use database name, in TAdoDBConnection.GetRowCount(). See http://www.heidisql.com/forum.php?t=15438#p18200
ansgar's profile image ansgar posted 9 years ago Permalink
For me that worked, but it seems that MSSQL 2k wants the database name, not the schema name here. Should be fixed in r4942.
[expired user #8855]'s profile image [expired user #8855] posted 9 years ago Permalink
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's profile image ansgar posted 9 years ago Permalink
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.
[expired user #8855]'s profile image [expired user #8855] posted 9 years ago Permalink
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.
[expired user #8855]'s profile image [expired user #8855] posted 9 years ago Permalink
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.