Shortcut for Queries in SQL Developer - oracle-sqldeveloper

My colleagues using TOAD has a nice feature of a shortcut to queries. For example, they write get_customer_info and the word is replaced by a full joined query. This feature is very nice for productivity. My machine is not licensed to Toad and I use Oracle SQL developer. I wasn't lucky enough to find this feature. I wonder if it has this feature in the first place?

SQLDeveloper has code templates for commonly used statements (see Tools > Preferences > Database > SQL Editor Code templates ). Then there are Snippets ( View > Snippets ) that can be dragged to existing code in the worksheet. It has also some built-in constructs (FOR, IF, etc.) that can be called with CTRL+SPACE if you start typing the statement. You could technically imitate TOADs behavior with the code templates and create templates for statements that you use often. I'm not sure if this even compares to TOADs capabilities, but that's pretty much all you have available in SQLDeveloper.

You may do this by editing Code Template.xml file in the following location:
C:\Users\username\AppData\Roaming\SQL Developer
Add/Edit the file to write convenient shortcut:
<row>
<key>upt</key>
<value>UPDATE table_name SET col_name='val' WHERE col_name='val';
</value>
</row>
[Please restart your sql developer after edit this file.]

Related

How to change auto-format for Transact-SQL code in Visual Studio 2017?

How do I stop Visual Studion 2017 form auto-formatting my T-SQL code and changing the case of keywords, functions, etc? I want to keep the code exactly as I type it. The only relevant option I see is under Editor - SQL Server Tools - IntelliSense - Casing for built-in functrion names, which does not seem to do anything (I changed it to Lower case, restarted the IDE, but it still converts them to upper case). I did not find anything relevant under the T-SQL90 and U-SQL, and I do not see any other T-SQL specific settings (I'd expect something like Transact-SQL, but there is no such option). Any idea?
Here is the first place which can't be easily found without using the search bar. Also, it's not language specific either unfortunately.
Search for 'format' and turn off 'format as you type' option
Here is the 2nd place I'm aware of
Search for 'pretty' and turn off reformatting
Hope this is helpful -- if you find a SQL specific way to avoid the annoyance please post a response to my answer.

How to create custom commands in VSCode?

In Emacs, I can create functions in Lisp language and place them in .emacs file. Those function will become commands that can be called from the editor or bound to keys just like any other built-in command.
Is there a way to do that in VSCode?
Note: The custom commands need to be able to call other commands. Simply using a batch file and running it as a task will not work.
A few marketplace extensions may be of interest:
Script Commands by Marcel J. Kloubert
multi-command by ryuta46
However in general, you'll need to write an extension to do anything complex.
There's also a VS Code issue tracking support for built-in macros
There's Power Tools by e.GO:digital. It has support for custom commands and event triggers (ie. on file changed), among other things.

SQL Developer format like Toad's Quest Parser version 5

I use version control and some of my team use Toad, others use SQL Developer. Is there someway to align the two formats?
The reason being that when you compare the versions most of the changes are due to formatting.
In Toad, you use Ctrl + Shift + F
In SQL Developer, you use Ctrl + F7
In SQL Developer it has some other formatting, but nothing for Toad which uses QP5 (Quest Parser Version 5)
You can change how SQL Developer formats your code; from the menu go to:
Tools->Preferences->Code Editor->Format.
Go into Advanced Formatting to configure alignment, line breaks. whitespace etc.
Toad presumably has similar options. You just need to set them up the same, which may need a bit of trial and error to get right.

SQL SERVER MANAGEMENT STUDIO: Highlight variables

Is there a way in SQL SERVER MANAGEMENT STUDIO to highlight all usage of variables when we click on a variable name?
It might not work in all cases, but I find that using the F2 button, which on my machine is mapped to 'View.EditLabel'. It allows me to highlight all of one 'type' things like aliases, variable names and others. Not perfect, but fits my purpose.
I still stand by the fact that it might not be perfect, but it does do what the original poster asked. If you want to see what this command is mapped to see the Options windows.
In the last version of SSMS (currently version 17.1), select the text and type CTRL + F .
No, there's not such feature on SSMS
This has been added in SSMS 2016.
Available for download from https://msdn.microsoft.com/en-us/library/mt238290.aspx

Lotus Notes Diff Tool

Is there any diff tool for Lotus Notes which allows to compare scripts, design elements and documents?
I see this is an old question, and most of the other answers are a little outdated now, so I thought I would add some hopefully valuable information for those who should stumble upon this now.
In Domino Designer, open either the Navigator or Package Explorer (Window menu -> Show Eclipse Views). Here you can expand databases/templates to see the design elements they contain. Select two or three elements (CTRL-click). They can be in different databases or the same database. Right click on one of the elements and select Compare with -> Each other.
You can also compare two databases element by element by selecting two databases/templates, right-clicking and selecting Compare with -> Each other. You will then get the differences between the two databases listed. You will be able to see which elements differ between the two databases, and which elements exist in one database but not the other. By double-clicking on a differing element, you will open a diff tool which lets you see differences line by line, and you can easily copy changes from left to right or right to left.
There is a tool from TeamStudio called Delta: http://www.teamstudio.com/products/delta.html
If all else fails (and by "all else" I mean the often ridiculous corporate procurement system) you can always do a an export to DXL (or a Design Synopsis for code alone) and use any decent text editor with a diff function. It's not TeamStudio Delta, but it will get you where you want to go.
There is a free tool from OpenNTF which does document comparisons:
http://www.openntf.org/Projects/pmt.nsf/ProjectLookup/Compare%20Notes%20Documents
Ytria also has a product which, among other things, will compare data documents (I don't believe it compares design elements).
http://www.ytria.com/website.nsf/WebPageRequest/Solutions_scanEZ_specen
And, I believe Martin Scott (http://www.martinscott.com) has a similar product which compares documents.
DDE (Domino Designer on Eclipse) let's you compare design elements natively. Same way as the search. It's pretty efficient (faster than a DXL exportation) and it's free.
I had a discussion on my blog a little while back about this:
http://rosshawkins.net/archive/2009/12/24/notesdomino-refactoringanalysis-tools.aspx
However what I've ended up doing in the past is exporting the design to the filesystem and using standard text tools (WinMerge and SublimeText for me personally) to do what I need.
Being able to do the raw dump is something that was added with the Eclipse based designer, and isn't overly obvious, but you can read more about it here:
rosshawkins.net/archive/2010/01/20/searching-the-contents-of-notesdomino-design-elements.aspx
(link mangled as my rep is too low to post 2 links in one post yet!)
Teamstudio Delta is really nice. However it might kill you with too many details. As Ross pointed out the Domino Designer 8.5 can use the Diff tool inherited from Eclipse. You also could head over to http://www.openntf.org and look for the DXLMagic project. It can generate a report that shows differences (including code) between 2 databases (typically a template and a variation of it). It is not as complete as Delta, but shows the essentials. It's free and source is included (Disclaimer: I wrote it).
This is what I do. I run a design synopsis of the database using the Notes Designer. Dump the file to a text file. You can actually split the synopsis out to different objects like Agents, Forms, Views, etc. Then you can run UNIX/Linux/Mac Unix commands to compare the elements. By doing this operation you find out what code is active, and have a complete documented source code. You do a lot of csplit and a few sed commands.
Version 12.0.1 has such a tool as part of the server. Look for comparedbs.ntf and designsynopsis.ntf on the Domino server.