Retrieve SQL Management Studio Query - sql-server

I had one important unsaved query in SQL Management Studio. Accidentally I closed that tab and now I need to retrieve that query. Is there anyway?
SQL Management Studio Version: Microsoft SQL Server Management Studio 12.0.2569.0
Update:
I checked at Recover unsaved SQL query scripts link and I did not find my query files there.
I executed that query multiple times yesterday.

Related

Visual Studio Community: how to view data or run SQL in the "SQL Server Object Explorer"

You can "explore" the schema etc. using the SQL Server Object Explorer in VS.
However, I can't find a way to view the data in a given table (at least the first page), or to run some arbitrary SQL.
Is this possible?
I also have the full blown Microsoft SQL Server Manager installed, but this can't "see" the databases created by Visual Studio in its built-in SQL Server Express instance. It can only connect to its own full blown SQL Server databases.
I have looked for a tool to view data in SQL Server Express, but have not found anything yet. There does not seem to be a version of Microsoft SQL Server Manager for SQL Server Express unfortunately.
You can do a "New Query" on any database node to run a query window:
And then you can do a "View Data" on any table, in SQL Server Object Explorer:
But you should also be able to load any "LocalDB" instance and view it from the full-fledged SQL Server Management Studio (at least since SSMS v17, where it's a separate, free download)....

Can not modify stored procedure on Azure

I'm new to Azure SQL database.
I managed to migrate my database to the cloud.
Now I'm trying to modify a stored procedure using Microsoft SQL Server Management Studio (the latest edition - 2014). But get the following error message:
USE statement is not supported to switch between databases. Use a new
connection to connect to a different database.
Any idea how can I do this?
Also, is there any alternatives to Microsoft SQL Server Management Studio to work with Azure SQL Database?
USE in sql is used to switch between databases not to modify stored procedures. You cannot use USE on Azure SQL as per the specification. You should be able to right-click on the database name in Microsoft SQL Server Management Studio (SSMS) and select New Query, or you can use the dropdown list in the menu to switch databases. You can then use ALTER PROCEDURE (https://msdn.microsoft.com/en-GB/library/ms189762.aspx) to alter your procedure.
You can use Visual Studio as an alternative to SSMS but IMHO Visual Studio is not as productive. It doesnt matter which client you use though, because USE wont work in any of them.

Where is the SQL Query Analyzer in SQL Server Management Studio 2012

I have some SQL thats getting run and it is taking to long to return the results / parse / display, etc. application.
I have SQL Server Management Studio 2012 installed.but i am not able to find SQL Query Analyser.
Any Input will be appreciable.
Take a look at this link http://consultingblogs.emc.com/jamiethomson/archive/2008/07/10/query-analyzer-or-management-studio.aspx
The Query Analyzer (QA) was the query tool provided with SQL Server up until SQL Server 2000. In SQL Server 2005 and above it was superseded by SQL Server Management Studio (SSMS). If you would like to detect any performance problems in some of your queries you can use the execution plan to determine what is the culprit.
How to analyze a query : http://technet.microsoft.com/en-us/library/ms191227(v=sql.105).aspx
Briefing of how to analyze an execution plan : https://www.simple-talk.com/sql/performance/execution-plan-basics/
Are 2 links which definately can get you going. Also take a look at this introduction to SSMS 2012 which also can be useful https://www.youtube.com/watch?v=YipAwZ3Riok
starting from SQL Server 2005, SQL Server Management Studio is the new management tool (Enterprise manager replaced). Thus, the "New Query" tab is the place where you can write down and analyze your queries. You can see the Execution Plan, client data and so on.
SQL Query Analyzer does not exist anymore.

I can't find the SQL Server 2005 Database Tuning Advisor

I can't find the SQL Server 2005 Database Tuning Advisor on my computer. Is it something I needed to specifically choose when I installed SQL Server 2005?
I looked in All Programs -> Microsoft SQL Server 2005 and also in the C:Program Files Microsoft SQL Server directory and didn't see anything that could have been it.
Open SQL Management studio then go to the Tools menu up top. Its the second one from the top

SQL Server Management Studio Clear Cache Code Completion

If you change a table, then code completion doesn't work anymore when writing a query in SQL Server Management Studio. Is there a way to clear this cache?
(SQL Server 2008)
You can try
Edit -> Intellisense -> Refresh Local
Cache (CTRL+Shift+R)
From SQL Server 2008 Intellisense update/refresh on schema changes

Resources