June 15, 2015 at 8:12 am
Comments posted to this topic are about the item Productivity Keyboard Shortcuts 2
July 9, 2015 at 1:00 am
I think We can Directly Add like this
Tools >> Options >> Environment > Keyboard
no need to Create SP-Script it will work
Alt+F1 Sp_Help
Ctrl+F1 Sp_HelpText
Ctrl+1 Sp_Who
Ctrl+2 Sp_Lock
Ctrl+3 Select * FROM
Ctrl+4 Select Top 100 * From
please correct me if i am wrong
July 9, 2015 at 1:30 am
You could, but you won't have that much flexibility and you can send many parameters to stored procedure, for example you want to search for an object that contains "product" in the name but you want the search to return only procedures (you need 2 parameters), type "#product#, P" highlight it and press CTRL+5 and there you have it.
Or you want to do a "SELECT TOP 1000..." but you want to order it by a specific column, let’s say price, but from the highest to lowest value, just write "SomeTable, Price#" highlight it and press CTRL+3
Personally I find it very helpful to navigate through a database just by using those shortcuts and works for me very well and for my colleges, it took them a little time to get used to it but once they did they won't work without it anymore..
July 13, 2015 at 6:57 am
I thought this was a great idea, but in trying it I get incorrect syntax errors. I'm not sure what I'm doing wrong - I added the commands into the options dialog, ran the script and restarted SSMS. I do see the two new sprocs in master...
Any ideas?
Thanks
July 13, 2015 at 7:05 am
Double check you entry in keyboard shortcuts settings from step 3, make sure you leave comma at the end, give me am example what would you like to do.
July 13, 2015 at 7:34 am
Thanks for the great script.
July 13, 2015 at 7:55 am
Kutang Pan (7/13/2015)
Double check you entry in keyboard shortcuts settings from step 3, make sure you leave comma at the end, give me am example what would you like to do.
That's exactly what it was - the comma. I must have been careless with my cut/paste.
Nice job, thanks.
July 13, 2015 at 7:59 am
Any suggestions about the functionality and future enhancements highly appreciated! :hehe:
July 13, 2015 at 8:16 am
Kutang Pan (7/13/2015)
Any suggestions about the functionality and future enhancements highly appreciated! :hehe:
Well, I don't know how you'd get around it, but it would be nice if the shortcut opened a new query and ran there. As it stands, we need to type things like parameters and '%' after column names, then run. That's a little painful because we have to do it right in the code we're working on, or copy paste manually into a new window.
July 13, 2015 at 8:27 am
Agree with % being painful to add while working... Was thinking to add it for ctrl 5 8 9 as default on bith sides
July 13, 2015 at 9:08 am
Not sure how this is supposed to work
I tried highlighting a table name in Object Explorer and pressing [Ctrl] 9 but get nothing
Tried dragging table name onto new query page, highlight name and press [Ctrl] 9 but get syntax error
keyboard code is:
DECLARE @DB NVARCHAR(500) SET @DB = DB_NAME() EXEC master.dbo.Shortcuts 9, @DB,
When I paste the code and than put my table name in the command it works well but not the keyboard shortcut...?
DECLARE @DB NVARCHAR(500) SET @DB = DB_NAME() EXEC master.dbo.Shortcuts 9, @DB, '[dbo].[profiles]'
TIA
Tom in Sacramento - For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
July 13, 2015 at 9:12 am
not in object explorer, in query window while writing code, the whole purpose of it is to keep your hands on keyboard
July 13, 2015 at 9:27 am
I have feedback regarding Ctrl-0 to search for a phrase in an object's script. I have something I've been running to do that as well, but it uses sys.sql_modules instead of sys.comments:
use MyDatabase
go
select distinct db_name(), o.name
from sys.sql_modules m (nolock)
inner join sys.objects o (nolock) on m.object_id = o.object_id
where m.definition like '%SomeText%'
The comment I incorporated at the top of the script explains why:
-- Use sys.sql_modules because all the procedure's contents are stored
-- in one row. syscomments only holds a maximum of 8000 characters
-- and will split the code into multiple rows if it goes over 8000
-- and your search string may get split in the process.
Just sharing in case you had any thoughts?
- Lisa
July 13, 2015 at 11:22 am
LSAdvantage (7/13/2015)
I have feedback regarding Ctrl-0 to search for a phrase in an object's script. I have something I've been running to do that as well, but it uses sys.sql_modules instead of sys.comments:
use MyDatabase
go
select distinct db_name(), o.name
from sys.sql_modules m (nolock)
inner join sys.objects o (nolock) on m.object_id = o.object_id
where m.definition like '%SomeText%'
The comment I incorporated at the top of the script explains why:
-- Use sys.sql_modules because all the procedure's contents are stored
-- in one row. syscomments only holds a maximum of 8000 characters
-- and will split the code into multiple rows if it goes over 8000
-- and your search string may get split in the process.
Just sharing in case you had any thoughts?
- Lisa
Thank you lisa i will look into int
July 13, 2015 at 3:14 pm
Remember you just have to highlight a piece of code, no need to open new query window
Viewing 15 posts - 1 through 15 (of 31 total)
You must be logged in to reply to this topic. Login to reply