I am trying to get the top 5 tables by size using pymssql against an MSSQL 2005 database. My query looks as follows:
declare @size table (name VARCHAR(33), rows VARCHAR(10), reserved VARCHAR(11), data VARCHAR(11), index_size VARCHAR(11), unused VARCHAR(11)); insert into @size exec sp_msforeachtable 'EXEC sp_spaceused ''?'' '; select top 5 * from @size order by cast(substring(reserved, 1, Charindex(' ', reserved)) as int) desc;
This executes perfectly well through SQL Server Management studio, but when I execute it through pymssql I get zero rows returned. All other queries using pymssql are working perfectly fine. I would understand if there were errors or something, but I can't explain why I am getting no rows.
Any help would be greatly appreciated.
Thanks!
--Scott
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to get the top 5 tables by size using pymssql against an MSSQL 2005 database. My query looks as follows:
declare @size table (name VARCHAR(33), rows VARCHAR(10), reserved VARCHAR(11), data VARCHAR(11), index_size VARCHAR(11), unused VARCHAR(11)); insert into @size exec sp_msforeachtable 'EXEC sp_spaceused ''?'' '; select top 5 * from @size order by cast(substring(reserved, 1, Charindex(' ', reserved)) as int) desc;
This executes perfectly well through SQL Server Management studio, but when I execute it through pymssql I get zero rows returned. All other queries using pymssql are working perfectly fine. I would understand if there were errors or something, but I can't explain why I am getting no rows.
Any help would be greatly appreciated.
Thanks!
--Scott