April 7, 2008 at 11:45 am
Hi guys,
I can't count how many times I have to type "SELECT * FROM" in the Management Studio Editor.
Is there a way to setup the Management Studio Editor (or maybe the Windows) to bring a text when I push a sequence of Shortcut.
Something like this: When I push CTRL-Shift-S then the text "SELECT * FROM" will be inserted in my editor.
Thanks,
Luiz.
April 7, 2008 at 12:28 pm
Time to pitch a Red-Gate product:
http://www.red-gate.com/products/SQL_Prompt/index.htm
You get some intellisense as well as shortcuts for frequently types "phrases".
April 8, 2008 at 4:23 am
[font="Courier New"]Hi Luiz,
You can go for SQL 2008 client tools where Microsoft have incorporated the above feature. 🙂
[/font]
Regards..Vidhya Sagar
SQL-Articles
April 8, 2008 at 11:38 am
Thank you for your answers.
Is there a way to do it through Windows?
Luiz.
April 8, 2008 at 2:05 pm
In SQL Server Management Studio:
Tools -> Options -> Environment -> Keyboard
-Eddie
Eddie Wuerch
MCM: SQL
April 8, 2008 at 3:09 pm
Eddie Wuerch (4/8/2008)
In SQL Server Management Studio:Tools -> Options -> Environment -> Keyboard
-Eddie
Eddie,
Your suggestion allows me to execute execute something using a shortcut.
What I want is to insert a text in the Mgmt Studio Editor.
Well, a second thought: your idea may work if it is possible to include a command that copy a text to clipboard and then past it back to the editor. Something like this:
sp_copyToclipboard 'select * from'
sp_PastFromclipboard
Does anybody know if there is a command or proc that copies something to clipboard ?
Luiz.
April 9, 2008 at 7:00 am
Clipmate, the clipboard-extender program I use, does that. You can evaluate it for 30 days, but then you'd have to buy the program.
April 9, 2008 at 7:46 am
SELECT * FROM
Lets see. That took less than 2 seconds. CTRL>SHIFT>S ? Maybe a little quicker.
What I need is something to automatically correct the dyslexic version that I frequently end up with:
SELECT * FORM
April 9, 2008 at 8:01 am
Proably is overkill for "SELECT * FROM"
I use SQLServer Management Studio templates for things like:
SELECT c.Description as Clinic, a.ApptDate,
p.NameLast + ', ' +
COALESCE(p.NameFirst,'') + ' ' +
COALESCE(p.NameMiddle,'') + ' ' +
COALESCE(p.NameSuffix,'') + ' ' +
COALESCE(p.NamePrefix,'') AS PatientName,
CASE
WHEN MissedAppt = 'Y' THEN 'No Show'
WHEN MissedAppt = 'S' THEN 'Show'
WHEN Cancelled = 'Y' THEN 'Cancel'
ELSE '--' END as Disposition
FROM Appointment a INNER JOIN Clinic c
ON a.ClinicSID = c.ClinicSID
INNER JOIN Patient p
ON a.PatientSID = p.PatientSID
(got tired of typing the COALESCEs - takes me 3 tries to type it right, every time.)
It's a drag & drop rather than a hot-key but it comes with SSMS.
April 9, 2008 at 1:41 pm
Well, I see that it's not only me who has problems with "SELECT * FORM" and COALESCE.
It seems that Mgmt Studio still doesn't offer a solution for (the not only) my problem.
But as was pointed earlier, a third part solution, such as Clipmate, can help me.
Does anybody know one that is free?
Thanks,
Luiz.
April 29, 2008 at 2:01 pm
Perhaps you could try AutoHotKey. It seems like it would have what you are looking for and it is free. I have not used this personally but a friend of mine uses it alot for all different things, such as auto filling login info when developing as well as SQL syntax.
Personally, I have used SQL Prompt by RedGate and like that alot. But, it does cost money.
John
April 30, 2008 at 3:18 pm
Thanks, John.
I installed Autohotkey and it solved my problem.
Luiz.
May 1, 2008 at 2:14 am
There is a fairly short method of inserting any text you want into the editor. Within the Management Studio I have a 5 keystroke sequence setup that also does the trick.
First you will need to customize the toolbar by adding a tool found in the 'Edit' subcategory called 'Insert File'. To make this item keyboard accessible simply give it a new name with the '&'. ex: 'In&sert File' will allow the command to be triggered using the {S} key after hitting {ALT}.
Next you would create a file containing your text. I found that saving the file as a .sql filetype made it easier to find plus I gave it a short name as 's.sql'. As long as you have this file saved in the folder that your insert file dialog box opens up with then you're all set.
From here it's a quick key sequence of {ALT}, {S}, {ENTER}, {S}, {ENTER}. And waulla! your code comes strolling in. The aspect I like with this solution is there are no key combos and every key can be hit without taking your fingers off the home keys.
Autohotkey may be just what the doctor ordered. But it never hurts to have a backup plan.:cool:
Thanks,
Jody
May 1, 2008 at 1:16 pm
Another alternative for people who like to type as little as possible:
Try ctrl+shift+Q, which brings up the query designer (in SSMS) using the database of the current connection. Then select a table and close the table selector. Then select all columns or individual columns and click OK. The query is now in a regular query tab/window.
That may sound like a lot of work, but it's easier than typing:
SELECT system_monthly_summary_trustIXeligibility.*
FROM system_monthly_summary_trustIXeligibility
May 1, 2008 at 9:53 pm
Luiz (4/30/2008)
Thanks, John.I installed Autohotkey and it solved my problem.
Luiz.
Your welcome. The benefits from this program is that it can be used in other applications. 🙂
Viewing 15 posts - 1 through 15 (of 19 total)
You must be logged in to reply to this topic. Login to reply