view MDX query from SSMS - ssms

Any chance I can see the query generated when I'm browsing a cube through SSMS?
I supposed I could run a trace on the DB to capture it, but just wondering if there is an easier way.
Thanks

I am not sure about SSMS (other than trace) but there is an add in for excel which allows you to see the MDX generated on pivot tables. The MDX is sort of similar:
http://olappivottableextend.codeplex.com/

Using the SQL Server Profiler you could see the query generated. Just connect to Analysis Services server and save the trace.

Related

SQL Server Profiler Not Like Filter

I am using SQL Server Profiler 2019. My "Not Like" filter on "Application" is not working. It is still getting values for "SQLAgent". See values below. How do I exclude those values properly?
The wildcard character for SQL Profiler is, like in SQL generally, %. So use SQLAgent% as your value for NOT LIKE and it should work.
As an aside, I love SQL Profiler too but you should ideally use Extended Events sessions which have a much lighter impact on the SQL Server and are way more powerful. You can easily start one by double-clicking on the XEvent Profiler > Standard node in SQL Server Management Studio's Object Explorer window:
Then you can use the toolbar that appears to edit Filters etc. There's lots of good resources out there for getting to grips with extended events (XE) ... although I still prefer some things about SQL Profiler's UI.

View SQL Blocks/Locks?

I was wondering if there is there a tool or a way to view which statements cause a block/lock and which objects would be affected? I know about sp_who and sp_who2, but those only work while the system is running.
For example, I know running this:
UPDATE myTable SET col1 = 'something'
Will put a lock on "myTable", but there are more complex scenarios (like nested procs and triggers) that would be more difficult to identify.
I was hoping for tool like the "Actual Execution Plan" built-into SSMS, but other tools, queries will suffice
Thanks all
You can refer this blog and follow the different ways to identify the blocks:
sp_who2 System Stored Procedure
sys.dm_exec_requests DMV
Sys.dm_os_waiting_tasks
SQL Server Management Studio Activity Monitor
SQL Server Management Studio Reports
SQL Server Profiler
Also check: Different techniques to identify blocking in SQL Server
You can use SQL Activity Monitor (right click on the SQL instance in SSMS) to get a list the number of current locks etc and you can use the 'Task State' column of the 'Processes' panel in there to see currently running statements which will tell you if things are blocking.
These all focus on activities which are currently executing though, so I'm not sure this will be what you want.

federation sql view azure

So I've been trying to use federations in SQL Azure for my site.
I've been first trying to find a tool where i can test my coding with a full graphic interface.
I'm unable to find the context menu for edit top 200 rows in SSMS (SQL Server Management Studio).
Can anyone help?
There may not be exactly GUI interface to play completely with SQL Database federation through SSMS R2 however combining proper queries together with SSMS you may be able to get the results you are looking for. I am not sure how you are trying to display first 200 records with your federated data however if you provide more steps how do you do it, I may add more info.
FYI, here is how SSMS is used to work with SQL Database Federation.

SQL Server activity monitor show all queries

I'm using SQL Server 2005, and I'd like to know if there is any possibility to watch every query sent to SQL server?
SQL Server Management Studio has a built-in tool called the Activity Monitor which gives me nearly what I am searching for in the "Recent Expensive Queries Pane"
This pane shows information about the most expensive queries that have been run on the instance over the last 30 seconds.
I need exactly this for all recent queries, not just the expensive ones...
Can anyone help me?
Name a tool, or give me a hint what to search for...
To watch every query sent to SQL server using SQL profiler, you can use one of SQL Profiler predefined templates. It's TSQL_Duration.
It's designed to track completed stored procedures and TSQL code.
The trace will show you exactly the batch executed.
You can expand the events tracked and columns shown.You can find more information here: How To: Use SQL Profiler
The same feature is also available in ApexSQL Comply, an auditing tool that uses SQL traces to capture the events, then stores them in a central repository database, and provides built-in and custom reports where you can easily filter the transactions, and export them as Excel, Word, or PDF files.
Disclaimer: I work for ApexSQL as a Support Engineer
You're looking for SQL Profiler, it's usually installed along with SSMS.

See queries that hit SQL

Is there a way using sql 2008 Management Studio to look at the queries that hit the server? I'm trying to debug a program and I get messages like "Incorrect syntax near the keyword 'AND'". Since the queries are being dynamically generated it's a hassle to figure out what is going to the server.
Any help is appreciated!
There is a tool called Profiler that will tell you all information that you'll need. MSDN: http://msdn.microsoft.com/en-us/library/ms187929.aspx
I'm not aware of any method to do this using SQL Server Management Studio, but if you installed SSMS then you probably also installed the SQL Profiler. If you fire that up and run the TSQL_SPs profiler template, you can see every statement that's hitting the database.
Since the queries are being dynamically generated it's a hassle to figure out what is going to the server.
Why not just put the query that's generated into a message box, or print it to the console, or webpage, etc. ??
Trying to catch it at the DB server seems to be the long-way-around to debugging some simple ad-hoc queries.
Go to Management...Activity Monitor in the object explorer.
It's not live though, you will have to refresh it manually.
start up profiler from SSMS (Tools-->SQL Server Profiler), run a trace and select the T-SQL events
One option is to use SQL Server Profiler to run a trace. However, in some shops SQL Server permissions are set so only DBAs can run traces.
If you don't have sufficient rights to run a trace, then another option is to view the network traffic between the application that generates the SQL and box SQL Server is running on. WireShark works great for that.