MSSQL query not executing....
Christopher Bielinski <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Hello… First time on here and I was wondering if I could get a little help with one of my queries. The query: IF EXISTS (select path from sys.traces where id = 1) BEGIN IF EXISTS (SELECT distinct(e.name) as Event_Name FROM fn_trace_geteventinfo(1) ei JOIN sys.trace_events e ON ei.eventid = e.trace_event_id JOIN sys.trace_columns c ON ei.columnid = c.trace_column_id where e.name = 'Audit Statement Permission Event') BEGIN SELECT 'Event is being Audited' as 'beingAudited' END ELSE BEGIN SELECT 'Event is not being Audited' as 'beingAudited' END END ELSE BEGIN select 'Trace file not found' as 'beingAudited' END …looks to see if there is a certain event that is being audited within a MSSQL Trace file. This query runs in the SSMS browser, but doesn’t when I pipe it through FreeTDS. I was wondering if the query was properly written (to the specs of FreeTDS), or if I’m missing something. This is the first query I’m using with the ‘IF EXISTS’ and ‘BEGIN/END’ objects. Could these present any issues? Thanks, Chris Bielinski | [email protected] Policy Compliance | Senior Database Compliance Engineer *Qualys, Inc. *| *On Demand Security* |* **www.qualys.com* Direct: 650.801.6105 | Fax: 650.801.6101 Mobile: 720.273.9426