A plugin like "Resharper" for SQL Server Management Studio? - plugins

Does anybody know of a program or plugin for SQL Server Management Studio which is like Resharper for MS Visual Studio?
For example, it would be great to enter Ctrl-Shift-N and after starting to enter the name of a stored procedure to see list of stored procedures with most general commands like - alter, drop and create.

Look at the ApexSQL refactor, it is FREE amazing add-in for Visual Studio and SQL Management Studio. http://www.apexsql.com/sql_tools_refactor.aspx

You can try SQL Prompt by redgate

I came across another interesting plugin called SqlSmash. It works with SSMS 2012 and is free for now it looks like.
Features from the website:
Go To Object: Easily navigate to any of the tables, stored procedures, functions or triggers in any of your databases.
Format Sql: Apply your casing preferences to the keywords, variables and identifiers and indent the Sql.
Execute Current Query: Only execute the query that your cursor is placed at.
Search Objects: Search all your database objects for any text.
Summarize Script: Summarize complex scripts and navigate around easily.
Go To Definition: Show the definition of a Sql object quickly.
Find All References: Find what other objects are referencing the Sql Object under your cursor.
Quick Info: Get a quick overview about the Sql Object under your cursor.

I don't think it has that autocomplete feature you've mentioned (which is in MS Management Studio >= 2008) but the "SSMS Tools Pack" add-in has some other features you might be interested in:
http://www.ssmstoolspack.com/
Features:
SQL Snippets
Window Connection Coloring
Window Content History, Query Execution History and Current Window History
Format SQL
Search Table, View or Database Data
Run one script on multiple databases
Copy execution plan bitmaps to clipboard or file
Search Results in Grid Mode
Generate Insert statements from resultsets, tables or database
Regions and Debug sections
Running custom scripts from Object Explorer
CRUD stored procedure generation
New query template
General options

Related

Can we see IBM DB2 stored procedure content in AQT(Advanced Query Tool)?

I am not an expert in IBM Host tools as I am from development distributed side. Is there anyway that we can see the source code of IBM DB2 stored procedure in AQT tool. I know we can use any emulator tools like Attachmate Extra! X-treme, but the process seems very tough for me. To view a single stored procedure content, I had to type many number of commands. So I just thought it would be great if we have an option to view the same in a simple way, like we have sp_helptext in SQL SSMS (SQL Server Management Studio).
Update:
When I go to the Database Objects -> Procedures, all the schema's for different stored procedures are loading. And when I click on each schema, the stored procedures associated with that are loading, where I am able to see the procedure parameters, run procedure, create procedure etc. But I couldn't find any option to see the actual SQL query of the procedure.
When I click right click on procedure name and select View, I am getting options as,
Procedure Details
Procedure Params
User Access List
Package Access List
I am not seeing any option like Procedure Text. The language in Procedure Detail shows as COBOL and User Access List shows Execute G. Sorry that I can't provide any screenshots here, as it is the client machine I am working on.
Are you using the right tool for the job?
The AQT tool appears to be for procedures that are written in SQL, but your procedures appear to be COBOL stored-procedures. Source code for COBOL stored-procedures is normally managed outside of the RDBMS.
Talk with your DBA team or COBOL developers to find out which toolset at your site gives access to the source code for the COBOL stored procedures.

Reference to CTE from another file

I use CTEs (common table expressions) in SQL developer to make my queries more structured, and also with the intent to create "bricks" which I can reuse in queries.
For the second purpose it would be good to keep those CTEs in a separate file, so I don't need to browse for the latest version.
Is it possible to refer to CTE in another file in Oracle's SQL developer?
I know I could create queries / views in the database and use them, but unfortunately I don't have access to that.
One way to go would be code templates in SQL Developer itself. So you could code up your most frequent CTE's and invoke them with the keyboard.
I talk about those here
But basically you code them up in the preferences, and give them a name.
Then type the name, and hit ctrl+space to invoke the template.
You can also set these up as Auto-Replace.
For what it's worth - you CAN reference code from other files using the # and ## commands. However, it will take the contents of that file and execute as a complete, standalone SQL statement or series of statements, so I don't think you can use this to achieve your goal.

Graphical query designer for PostgreSQL

I have for years used MS Access and its query tool that is used for making queries. This tool is so good that I have never been forced to do very much SQL programming myself. The query tool has done all the work.
However, now I have started using Postgres and the Graphical Query Builder in pgAdmin. It seems that the Graphical Query Builder is rather primitive: It cannot be used if you need an aggregate function like SUM or COUNT.
Is this really correct?
Does anybody know a better graphical query builder for PostgreSQL?
Until now I have 'solved' the problem by linking MS Access to the Postgres database through ODBC and used MS Access' query tool to generate SQL commands which I then copy into pgAdmin's Graphical Query Builder - and edit the SQL commands until everything is correct.
SQL Maestro has a query designer, although it is PC only, AFAIK
http://www.sqlmaestro.com/products/postgresql/maestro/screenshots/getting_started/visual_query_builder/
EMS SQL Manager also has a query designer
http://www.sqlmanager.net/en/products/postgresql/manager/screenshots
Try SQLeo, its free and has a specific feature (autosavepoint) to prevent
ERROR: current transaction is aborted, commands ignored until end of transaction block.
Try a browser-based query builder for PostgreSQL called Skyvia. And you don’t have to worry about which operating system it works. It works where a browser exists. Simply make a connection to your PostgreSQL database and start building your queries. See a sample below.
Note that you can still switch between SQL code and query builder if you want to, just like in MS Access. Get the details here.

Execute script from MySQL workbench EER model?

There's a facility in MySQL Workbench's EER Modelling mode to write an SQL script that's stored with the model. But I've looked all over the place and can't see any way of executing such a script, other than by copying and pasting it into a window of the query mode. There's a menu item Scripting/Run Script, but it doesn't seem to actually do anything. Surely there must be some application of the scripts section of the model beyond just storing SQL text?
Running arbitrary SQL code during forward engineering or synchronization is not possible. The only code that gets executed is the sql to create the objects and to fill tables with data specified in the Inserts section of the table editor.
Running an sql script in general is of course possible and also trivial. Simply open a connection to your server (you should have one created on the home screen, if not do this first). Then in the editor toolbar there's a button to open a script. Use that to open the file (if you have a separate sql file). If you want to run code that is stored in the model (as SQL file) you have to copy/paste it over.

Using database project and SQL Data Tools in Visual Studio 2012 : How do I get temp tables to resolve?

I am learning Visual Studio 2012's "database project" system, using Visual Studio 2012 with Update 1, plus SSDT.
I am finding it very good at finding real problems in my database, especially programming errors in stored procedures where someone has removed a field from a database table but didn't go through and verify that all the stored procedures execute without errors. So validation of your .sql scripts via the "build" command in Visual Studio 2012 is very handy. I would hate to abandon it.
But I also note that whenever a #TEMPTABLE is used in a stored procedure, even when "Enable Extended Transact-SQL verification for common objects" is turned off, I still get "build errors" involving #temptable.field references in stored procedures.
What steps does the Database Project take to determine the schema of a temporary table? Since my temporary tables by definition don't exist in the main schema, they didn't get into my Database Project when I imported a real production SQL database into Visual Studio via the Import Database option, right after creating the database.
Should I be creating "#TEMPTABLE.SQL" files and adding them to my project?
Sample error:
c:\dev\...\dbo\Stored Procedures\xyz.sql(95,96): Warning: SQL71502: Procedure: [dbo].[proc123] has an unresolved reference to object [#temptable1].[somefield1].
If there was a way to include a script that defined the temptables in use once, and include it into the various places where it's necessary to know about these if the T-SQL is to be thoroughly validated, that would be fine, and if Turning of Extended Verification did what I think it's supposed to do, then perhaps nothing would be necessary.
Forum post suggests this isn't possible to fix and that all I can do is effectively turn off this warning at a file level, which is kind of horrible.
A question on this same subject but for Visual Studio 2010 suggests that this is an area where this technology has been just flat out broken and Microsoft has known for years about it and done nothing about it. Is anything better now in VS2012.U1+SSDT_Dec2012?
Thats a problem with temp table, you should use table valued functions.