SQL Views - How to determine underlying tables? - sql

I have been gathering data from a view for reporting purposes quite some time related to volume, SLA, etc...
However I want to know what tables make up the view itself..I am currently using SQL Server 2012 and I have been asked some questions on the underlying data within the view...however we have hundreds of tables and I don't know where to look..
Just wondering if there is a quick way to check which tables make up a view..
Thanks.

You have a few options:
Right-click the view and click "Design" (as already mentioned)
Right-click the view. Select "Script View as" > "CREATE to" > "New Query Editor Window"
Right-click the view. Select "View Dependencies". Then select the "Objects on which depends" radio button.
Hope that helps you out.
Marius

Related

Powerbi - view the query used to pull in data

I've downloaded the pbix of a report from a colleague. I'd like to view the SQL query that was used to pull the data into this report. When clicking on 'edit queries' I can see the output of the query, but not the query itself. How do I view the query itself? Note I would like to see the query before any steps Power BI takes. I found something in 'advanced editor' that looks code-like but it doesn't seem to be the raw original code.
Click on the table/query on the left pane. On the right side you see the steps he applied in the query designer and under Home > Advanced Editor you see the whole code what happended.

SSMS SQL editor tool bar grayed out

I posted this earlier and obviously the person who marked it as duplicate did not read the post because the answer told me to do exactly what I said I was doing that does not work.
New install of SQL Server 2017 Express with existing databases. Login as sa or as a database owner. When you right click a table - Edit top 200 rows - open the SQL panel. The entire SQL editor toolbar is grayed out. I can copy the same SQL expression into a new query and the bar is active. I can execute the expression with Ctrl R when the bar is grayed out.
I have looked at dozens of posts but have not found the solution.
FYI Yes, I can write the SQL statement to update the table but it is faster, easier and safer to update it directly when you only have to change one number in a single row/column and I can update the data even with the tool bar grayed out.
Thank you to the one who has the solution.
I had the same problem. Tried many different things. Toolbar remained greyed out. Then looked at the shortcut for Execute by hovering over it and saw it was Alt X, ran the query using Alt X, the toolbar then became active, have no idea why. Note: Now the toolbar is active, the shortcut to Execute the query is now F5. (Alt X also still works).

Remain in "SQL Mode" in Access?

Right now, if I want to enter SQL queries in Microsoft Access, I do this:
Click the Create tab, then Query design button, then close the popup. Click the SQL button. Type my query. Click Run.
For my next query, I have to do that all over again. How can I stay in an SQL environment in Access?
Newer versions of Access still support many of the same keyboard shortcuts for the old Menu commands (in addition to the newer, longer keyboard shortcuts for the Ribbon interface). So, in the Access 2010 query designer I still use:
Altv, d which was View > Design View
Altv, s which was View > DataSheet View
Altv, q which was View > SQL View
To run an action query, this old keyboard shortcut still works, too:
Altq, r which was Query > Run
Ah, it turns out it's one of the view modes (first button in the Home tab). Because none of my functions required a table, I hadn't bothered to choose a table to work in, which means the View menu was grayed out.

Edit arbitrary database values with the SQL Server Management Studio GUI

In MySQL Workbench, as long as you can display a row, you can edit it by typing in the cells.
Is there any way to do that with SQL Server Management Studio? SSMS seems limited to providing a GUI editor for the top 200 entries.
You can edit the query used to display the rows to edit by opening the "Query Designer" menu and selecting "Pane"->"SQL".
Once you've made your changes open the "Query Designer" menu and click "Execute SQL".
(Note these commands are also available on the toolbar and have hotkeys associated with them by default).

Query Designer toolbar grayed out?

I am using the Query Designer in SQL Server Management Studio (on an Express 2008 database). I created a new Query, chose Design Query in Editor from the Query toolbar and was presented with a cool graphical query designer (a bit like the one in ACCESS). I selected the fields, which generated the T-SQL, and executed the query and thought awesome! However, I can then only modify the T-SQL manually, I cannot get back into the graphical designer as all the Query Designer toolbar options are grayed out. Am I missing something?
Highlight the query text, then right-click, and select "Design Query in Editor...".