I know SQL server query analyzer provides a tool for determining the cost of a query. But my question is does anyone know how to do this programatically from java or c#? Is there a simple statment I can run against the connection or is there information in the meta data? Thanks for the help.
Yes there are ways. I would invest in Microsoft SQL Server 2000 Performance Optimizations and Tuning Handbook ISBN 1 55558 241 9
It shows you a lot of SQL code which will return this information for you. Also it is a very good book on performance tuning.