HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How do I configure SQL Profiler to show me queries to the views sys.databases and sys.tables?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
showtablesthehowdatabasessqlviewssysprofilerand

Problem

I have a simple C# app that iterates through all databases on a server examining their schema. As such it performs a SELECT name from sys.database, iterated through those and does a SELECT name from sys.tables WHERE name='Something'. Then if it finds the table its looking for it does some queries, and does stuff with the data.

The connection string has an application name. If I setup a trace with a column filter on that application name looking for start/complete transaction, start/complete stored procedure, and complete statement. I see the queries I perform on the actual database tables, but not the queries to sys.databases and sys.tables.

Solution

There's nothing inherent in Profiler that would prevent those queries from being displayed. I think you're just not catching the right events. It sounds like you're filtering for Stored Procedure events. Try also filtering for TSQL events.

Context

StackExchange Database Administrators Q#17743, answer score: 2

Revisions (0)

No revisions yet.