In the SQL Server Profiler, I've added a filter for:
DatabaseName Like MyDatabase
I then log into the same server and run:
select * from MyDatabase
I don't see any entries in the Profiler. I remove the above filter and run the statement again. It shows up in the Profiler.
Any idea why it isn't working with the filter?
Also, is there a way to filter on three databases? In other words, I want to see execution against three databases.
On the Events Selection tab of the Trace Properties window, hit the "Column Filters..." button and click on DatabaseName. From here you can filter to your database(s). If you double click on the "Like" group after entering your first database name, it will add another blank spot to enter a new name.
When you start a new trace, click the Event Selection tab and then click the "Show All Columns" checkbox. Then, scroll the window until you see the column "Database Name", and check all of the checkboxes there.
Related
I am editing a table row in SSMS, and when the row committed, it appeared tan-colored instead of black with a red exclamation mark indicating that there was a problem attempting to get the data back after the row committed.
It says to re-run the query, but I don't know how to do that, other than to close the window and re-load it via the context menu:
The "Execute" button is grayed out on the "SQL Editor" toolbar, and F5 doesn't work either.
How do you re-load or re-fresh the data in situ?
Try going to the "Query Designer" menu and clicking "Execute SQL".
I've never known this until just now, but it seems that the "Edit Top 200 rows" area you're in has query-builder options (such as "Add Table" and "Add Group By"), and you can press ctrl + 3 to get the sql statement involved. I even changed the Select Top (200) statement to Select Top 2 and produced an order by statement and it still produced an editable viewer, which I confirmed registered the edit.
As you noted the Execute button is part of the SQL Editor tool bar. You need the Query Designer tool bar, once present you can hit the Execute SQL button (the ! point), I believe there are also two shortcut keys (Ctrl+R) and (Alt+X).
I have a row in my table, and I want to change one of the values in a column. For example... I want to change the status in a particular row from "Development" to "Production".
In MySql Workbench there was an option to click the value and you could simply type in the value you wanted. Is there a similar method in Microsoft SQL Server without typing a SQL statement?
Right click on the table you want to edit and then choose Edit first 200 records.
In that table you can modify the values. It will be saved instantly.
Following up with the accepted answer, if you wanted to edit more rows than "Edit Top 200 Rows" gives you, you need to have the "Query Designer" selected in order to show the [SQL] button.
1) right click on the "New Query" button
2) select the "Query Designer" option
3) now your toolbar will look like this...
After you select the "Edit Top 200 Rows," you will see the SQL button (shown in yellow) that will show you the query where you can change the 200 to whatever you'd like.
I was having issues finding the "[SQL]" button, so hopefully the screenshot will help.
When I connect Access 2007 to SQL Server (whether by ADO recordset or by linked table) I no longer get check box lists (of available filter values) in the datasheet column filters.
Is this feature available only with MDB/ACCDB and/or DAO?
I think the check box in datasheet view of native Access tables is governed by the "Display Control" property in the table design. I don't recall what's available when the table is in SQL Server. If you provide a form in "datasheet view", you should be able to bind a check box control to the SQL Server column.
Edit: I think I misunderstood your question yesterday. If you click the Office Button, select Current Database, then put a check in the "ODBC fields" box under "Filter lookup options" ... does that do what you want?
I know we're breaking protocol by not opening a new question, but I'm going to answer this nevertheless so this thread will be complete. This is a more complete answer than the previous ones.
I think I have this topic nailed down now.
The lookup filters won't work with a recordsource that is not an Access object, and they don't work in linked tables directly.
You have to create a query of the linked table, for example: Select * from tblOrders, and use that query as the recordsource in order to get the lookup filters.
HOWEVER, I found a more flexible approach as well. I create passthrough queries to SQL/Server and use that as my recordsource. Then, in code, I set the SQL of the passthrough queries like this:
Currentdb.QueryDefs("qpstOrders").SQL="Select * from Orders where OrderID =" & Me.OrderID
In the current event of my subform, I change the query on the fly to pass the appropriate record -- or it can just be a more generic query. The lookup filters work fine this way and the interaction with SQL/Server is lightning fast.
Open the database that you want to optimize.
Click File > Options to open the Access Options dialog box.
In the left pane of the Access Options dialog box, click Current Database.
In the right pane, under Filter lookup options, mark "ODBC Fields" check box.
Is it possible to show a "Row Count" column in SQL Server Profiler?
For example there are CPU and Duration columns but can it show how many rows a query returns?
How about using the RowCounts column?
For SQL Server 2008 R2:
From the top menu: Tools -> SQL Server Profiler
Choose the Server name:
The Trace Properties dialog will appear.
Click on the Events Selection tab:
Click on the Show all columns check box
Slide the horizontal scroll bar to the right.
Check the boxes under the column RowCounts
Click Run
The trace will start displaying. The RowCounts column will be to the very right.
You can drag it to the left if you so desire.
Quite simply, no. It's not a measurable in profiler
How do I limit a SQL Server Profiler trace to a specific database? I can't see how to filter the trace to not see events for all databases on the instance I connect to.
Under Trace properties > Events Selection tab > select show all columns. Now under column filters, you should see the database name. Enter the database name for the Like section and you should see traces only for that database.
In SQL 2005, you first need to show the Database Name column in your trace. The easiest thing to do is to pick the Tuning template, which has that column added already.
Assuming you have the Tuning template selected, to filter:
Click the "Events Selection" tab
Click the "Column Filters" button
Check Show all Columns (Right Side Down)
Select "DatabaseName", click the plus next to Like in the right-hand pane, and type your database name.
I always save the trace to a table too so I can do LIKE queries on the trace data after the fact.
By experiment I was able to observe this:
When SQL Profiler 2005 or SQL Profiler 2000 is used with database residing in SQLServer 2000 - problem mentioned problem persists, but when SQL Profiler 2005 is used with SQLServer 2005 database, it works perfect!
In Summary, the issue seems to be prevalent in SQLServer 2000 & rectified in SQLServer 2005.
The solution for the issue when dealing with SQLServer 2000 is (as explained by wearejimbo)
Identify the DatabaseID of the database you want to filter by querying the sysdatabases table as below
SELECT *
FROM master..sysdatabases
WHERE name like '%your_db_name%' -- Remove this line to see all databases
ORDER BY dbid
Use the DatabaseID Filter (instead of DatabaseName) in the New Trace window of SQL Profiler 2000
In the Trace Properties go to the Event Selection tab. Then click on the Show All Columns radio button. After that click on the Column Filters button.
Now you can see the Database Name property and click on it. Expand the like box and insert your DB name and click ok and you can run the profiler now.
In the Trace properties, click the Events Selection tab at the top next to General. Then click Column Filters... at the bottom right. You can then select what to filter, such as TextData or DatabaseName.
Expand the Like node and enter your filter with the percentage % signs like %MyDatabaseName% or %TextDataToFilter%. Without the %% signs the filter will not work.
Also, make sure to check the checkbox Exclude rows that do not contain values' If you cannot find the field you are looking to filter such as DatabaseName go to the General tab and change your Template, blank one should contain all the fields.
Create a new template and check DBname. Use that template for your tracefile.