Friday 20 May 2016

Check Procedure exists in entire database

DECLARE @SQL NVARCHAR(max)
,@spName VARCHAR(100) = 'PROC_Name'

SELECT @SQL = STUFF((
SELECT ' UNION ALL
SELECT ' + quotename(NAME, '''') + ' AS Db_Name FROM ' + quotename(NAME) + '.INFORMATION_SCHEMA.Routines
WHERE ROUTINE_NAME Like  @spName  AND ROUTINE_TYPE = ''PROCEDURE'''
FROM sys.databases
ORDER BY NAME
FOR XML PATH('')
,TYPE
).value('.', 'nvarchar(max)'), 1, 11, '')

Print @SQL

EXECUTE sp_executeSQL @SQL
,N'@spName varchar(100)'
,@spName


Thursday 19 May 2016

Block Function Key usign JQuery

$(document).keydown(function(event){
    if(event.keyCode==123){
        return false;
    }
    else if (event.ctrlKey && event.shiftKey && event.keyCode==73){      
             return false;
    }
});

$(document).on("contextmenu",function(e){      
   e.preventDefault();
});