SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Closing Intellisense after CTRL-V

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Closing Intellisense after CTRL-V
Author Message
seth.rothman



Joined: 29 Jan 2008
Posts: 54
Country: United States

Post Closing Intellisense after CTRL-V Reply with quote
I'm always writing short SQL statement to grab data out of the database, only to use the results as the criteria for a new SQL statement. For example, if I write a quick SELECT * FROM Contact WHERE FirstName = 'Bob' and I need the ContactID field for a totally separate bit of SQL I'm going to write, I will copy copy the value from the results of the first statement I wrote and then start typing the next one. For example, once I had the appropriate ContactID value on the clipboard, I'd type "SELECT * FROM Note WHERE ContactID = ". The intellisense will popup after I type the "=" and then I'll paste my value there. I'd be more logical to me if the intellisense dropdown closed at that point so I could hit ENTER and then SHIFT-UP ARROW to highlight the SQL so I F5 it to run it (yes I'm using SMSS). What I've grown accustomed to doing is first hitting ESC and then going on about my business, but it's always been a bit of a nuisance.

I'm using the 5.0.67 beta, although I believe the behavior existed like this since the beginning of time. I figured if there was any hope that you agreed with me, it may make it into the final release of v5. Thx.
Thu Mar 25, 2010 11:29 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
There is a better way to do that using new $$...$$ macros. I believe you can automate the entire process. Please check the examples in User's Guide, search for $$...$$ or Advanced Code Snippets.
Thu Mar 25, 2010 1:34 pm View user's profile Send private message
seth.rothman



Joined: 29 Jan 2008
Posts: 54
Country: United States

Post Reply with quote
I'm not familiar with the $$ macros, but the majority of the SQL I'm talking about is more of an ad-hoc nature so I wouldn't think I'd have any saved macros for it.
Fri Mar 26, 2010 8:30 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
1. You can program $$...$$ macro to grab the line text, execute it, paste result into the editor , all with a single key press

Let's take your sample code
SELECT * FROM Contact WHERE FirstName = 'Bob'
and re-enter it as
Code:
SELECT TOP 1 ContactID FROM Contact WHERE FirstName = 'Bob'



Let' say you setup a new snipept with the code like
Code:
SELECT * FROM ... WHERE ... = $$ $CURRENT_LINE$ $$


And set Alt+0 as the hot key

Now if you enter
SELECT * FROM Contact WHERE FirstName = 'Bob'
and press Alt+0

you are going to get (let's say the returned value is 55)

Code:
SELECT * FROM ... WHERE ... = 55



This way, you get the code executed, you get the result pasted into the editor, you get a template for the next statement all with a single key press, no popups, no manual copy & paste


2. Another snippet idea ( a bit more advanced )

Code:
SELECT *
FROM $OBJECT$
WHERE $$ SELECT TOP 1 name FROM syscolumns WHERE id = object_id('$OBJECT$') ORDER BY colid $$ = $$ $CURRENT_LINE$ $$



The above should prompt you for the second table and generate the entire second statement, including complete FROM and WHERE clauses with table and column names, and the value returned from the first statement.
Fri Mar 26, 2010 9:18 am View user's profile Send private message
seth.rothman



Joined: 29 Jan 2008
Posts: 54
Country: United States

Post Reply with quote
That's pretty cool stuff. I'll definitely play around with them more. I'm still curious if you think my idea on closing the popup after a paste is a good idea...
Fri Mar 26, 2010 10:17 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
If it counts, I vote for that too. Though it's not a big deal to press escape it can be much more convenient this way.
Fri Mar 26, 2010 1:06 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Can somebody describe for me what exactly is "this way?"
Fri Mar 26, 2010 4:05 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
SysOp wrote:
Can somebody describe for me what exactly is "this way?"


Sorry. To close the popup after a pasting clipboard contents. If it is easy to achieve.
Sat Mar 27, 2010 4:11 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Thank you! I have submitted this request to the tracking system for further technical analysis.
Sat Mar 27, 2010 7:05 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.