extracting result set pertaining to sp_helpindex | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

extracting result set pertaining to sp_helpindex

I am making a jdbc call to my sql server and extracting the contents of sp_helpindex for each of the tables in the db, for example: String query = "sp_helpindex "+TABLE_NAME1;
ResultSet rs = stmt.executeQuery(query); but there are certain tables which donnot have indexes. I get a sql exception saying com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set. how do i take care of it, I tried insertng a !null condition for the contents of result set but it doesnt work. Any suggestion would be really appreciated thanks!

This is more of a client programming question. In SQL Server you could pipe the result of sp_helpindex into a temp table with INSERT INTO… EXEC sp_helpindex and check this for the existance of rows. —
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
thanks a lot!
You could take help of SP_MSforeachtable undocumented stored procedure in this case, as suggested by Frank that is preferred way. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.
]]>