Shortcut for search functionality in SQL Server -
i want create shortcut below sql code
declare @proc_name varchar(255) set @proc_name ='norway' select * sys.tables name '%' + @proc_name + '%'
right using below shortcut same
then type {like '%test%'} , press ctrl+8.
but want make more simplified format(like can type {test} , press ctrl+8) can use quickly.
i trying same in different way creating proc > execute > , drop on shortcut key press. more info please visit below link:
single line go(batch) statement giving error in sql server?
thanks,
vishal
i have following stored proc added master db on sql server
use [master] go set ansi_nulls on go set quoted_identifier on go create procedure [dbo].[sp_findallreferences] @targettext nvarchar(128) begin set nocount on; declare @origdb nvarchar(128) select @origdb = db_name() declare @sql nvarchar(1000) set @sql = 'use [' + @origdb +'];' set @sql += 'select object_name(m.object_id), m.* ' set @sql += 'from sys.sql_modules m m.definition n' + char(39) + '%' + @targettext + '%' + char(39) exec (@sql) set nocount off; end
then have added dbo.sp_findallreferences
1 of ssms keyboard shortcuts can search text in context of db on server.
for example, if type user in ssms query window, highlight , press shortcut combo, list of every stored proc in current database contains user
if replace select with
set @sql = 'use [' + @origdb +'];' set @sql += 'select * sys.tables name n' + char(39) + '%' + @targettext + '%' + char(39)
then able achieve goal.
Comments
Post a Comment