Skip to main content

Posts

List ALL triggers within a Database

In SQL Server 2005 and above, we can make use of SYS.TRIGGERS to list all the Triggers within a database. The below query would help us list the trigger name and the table name on which this trigger is written. SELECT [name] AS Trigger_Name, OBJECT_NAME(Parent_ID) FROM SYS.TRIGGERS ORDER BY Trigger_Name

Search a specific column within ALL tables

This stored procedure takes two parameters: 1. Column name to be searched within all tables 2. string/value which needs to be searched within all tables. CREATE PROCEDURE usp_SearchAllTables_InExistingDB ( @colName varchar(100), @colValue varchar(1000) ) As BEGIN -- Copyright © 2011 Vadivel Mohanakrishnan. All rights reserved. -- Purpose: To search a particular column of all tables for a given search string -- Written by: Vadivel Mohanakrishnan -- Site: http://vadivel.blogspot.com -- Tested on: SQL Server 2005 SET NOCOUNT ON --VARIABLE DECLARATION Declare @TableName nvarchar(100) Declare @ColumnName nvarchar(100) Declare @RowNum int Declare @searchString varchar(1000) Declare @columnToSearch varchar(100) --ASSIGN SP PARAMETER VALUE TO LOCAL VARIABLE Set @searchString = @colValue Set @ColumnToSearch = @colName --TEMP TABLE TO HOLD THE FINAL RESULT! CREATE TABLE #SearchResults ( TableName VARCHAR(1000), RecordCount INT ) -...

Database Backup from Command prompt

We can make use of "SQLCMD" to execute scripts from Command prompt. If you are new to it I would suggest to go over my introductory posts on them here . Example 1: Writing a batch file with the TSQL script to backup a DB. Save the below sample script as a batch file (lets say, DBBackup.Bat). echo off cls set /p DBNAME=Enter database name: set BACKUP=c:\%DBNAME%.bak set SQLSERVERNAME=Enter_Your_SQL_ServerName_here echo. sqlcmd -E -S %SQLSERVERNAME% -d master -Q "BACKUP DATABASE [%DBNAME%] TO DISK = N'%BACKUP%'" echo. pause We can now go to the SQL Command prompt by typing SQLCMD in Start > Run dialogue box. On executing DBBackup.Bat it would prompt us to enter the name of the database which has to be backed up. The backup file would be stored in C:\ drive. This is just a sample which can be modified or extended according to our need. Just in case we have already have a Stored procedure to backup the DB for us. Then we can still make use ...

Experts says Oracle slow on patching security issues

Check out this article Zero-day details underscore criticism of Oracle “They (Oracle) are one of the slowest to get things patched. It is astonishing how backwards they are in terms of fixing security issues.” -- David Litchfield, co-founder and principal security consultant, NGSSoftware The Apache module, which contains the flaw, allows Web applications to use the Procedural Language/Structured Query Language (PL/SQL) to dynamically create database calls. The code has security weaknesses that have been perennial sources of problems for the database maker. Oracle has patched various issues found by NGSSoftware four times, and each time, the company finds a way around the patch, Litchfield said.

Experts talking about security on MAC vs PC

Interesting read ... I urge you guys to spend some quality time going through this . "If you look at the number of published vulnerabilities in software and the number of users and compare Windows versus Mac OS you will discover that Mac OS has far more published vulnerabilities per user than Windows does so I think the data pretty much speaks for itself." -- 3ric Johanson, security researcher

Chrome learns from IE8

Chrome is learning from IE !! Google nothing to be ashamed off ... feel free to learn from the leader :) Google yesterday announced it has added several new security features to Chrome, including two that were first popularized by rival Microsoft in Internet Explorer 8 last year.

Deployability

Find below some useful articles on Deployability. Microsoft Deployment Toolkit (MDT) 2010 Microsoft Assessment and Planning Toolkit Choosing a Deployment Strategy The Windows Automated Installation Kit (AIK) for Windows 7 Microsoft Application Compatibility Toolkit 5.5 Understanding Application Compatibility Five Steps to Windows 7 Application Readiness Deploying Windows 7 from A to Z Windows 7 Enterprise 90-day Trial

Windows 7 related

Windows 7 related Download the new eBook on Deploying Windows 7 - http://go.microsoft.com/?linkid=9691265 77 Windows 7 Tips - http://technet.microsoft.com/en-in/magazine/2009.10.77windows(en-us).aspx Groovy Security in Windows 7 - http://technet.microsoft.com/en-in/magazine/2009.10.win7security(en-us).aspx Inside Windows 7 User Account Control - http://technet.microsoft.com/en-au/magazine/2009.07.uac.aspx AppLocker: IT’s First Security Panacea? - http://technet.microsoft.com/en-au/magazine/2009.10.geekofalltrades.aspx Useful Downloads Forefront Edge Protection: http://www.microsoft.com/forefront/edgesecurity/en/us/default.aspx Forefront Security Products Trial Software and Downloads: http://www.microsoft.com/forefront/en/us/try-it.aspx Microsoft Assessment and Planning (MAP) Toolkit for PC Security - http://technet.microsoft.com/hi-in/solutionaccelerators/dd627343(en-us).aspx Security Compliance Management Toolkit Series - http://technet.microsoft.com/hi-in/library/cc677002(en-us).aspx...

Competition News

1. Firefox flaws account for 44% of all browser bugs - http://www.computerworld.com/ s/article/9140582/Firefox_ flaws_account_for_44_of_all_ browser_bugs 2. Snow Leopard's more secure than Leopard, but it's not as secure as Vista or Windows 7 - http://www.computerworld.com/ s/article/9137992/Apple_ missed_security_boat_with_ Snow_Leopard_says_researcher? taxonomyId=17&pageNumber=2 3. Security Essentials tests better than Symantec, McAfee - http://blog.seattlepi.com/ microsoft/archives/189100.asp Latest Security Intelligence Report Shows Resurgence in Worm Attacks Review the latest Security Intelligence Report (SIRv7) to find deeper analysis and recommendations based on data input from over 450 million computers worldwide to help you successfully plan and manage protection technologies. - http://www.microsoft.com/ security/portal/Threat/SIR. aspx

Microsoft Security Development Lifecycle (SDL)

Educate yourself and your organization on how to build more secure applications. The SDL Developer Starter Kit offers content, labs, and training to help you establish a standardized approach to roll out the Microsoft Security Development Lifecycle (SDL) in your organization - http://msdn.microsoft.com/hi- in/security/sdl-starter-kit( en-us).aspx The Trustworthy Computing Security Development Lifecycle http://msdn.microsoft.com/en- us/library/ms995349.aspx SDL Home - http://msdn.microsoft.com/hi- in/security/cc448177.aspx SDL Blog - http://blogs.msdn.com/sdl/ Security Forums - http://social.msdn.microsoft. com/forums/en-US/sqlsecurity/ threads/

My Experience with TEDxChennai - Nov 29th 2009

TEDxChennai happened in IIT Madras on November 29th 2009. This is the first time I am attending one such event as the cost (Rs. 1028) was affordable for me :) If at all you haven't known, a ticket in TEDIndia was approx Rs. 1 Lakh and 10 thousand. It seems its 1/3rd cheaper than what it used to cost in California (approx 3L phew). Overall it was an mind blowing experience and I loved every moment of it. Post lunch sessions were power packed more interesting when compared with pre-lunch session. In particular I liked these sessions: 1. Romulus Earl Whitaker - a wildlife conservationist and founder of the Madras Snake Park! He should be called as 'Snake Man'. The snaps he showed and the work he explained made my jaw drop. 2. Sri. N. Vittal - ex-Central Vigilance Commissioner, ex-Secretary to Government of India in the Ministry of Information Technology, Chairman of the Telecom Commission and Secretary to the Department of Telecommunications. He has been columnist for the Econ...

How to find when SQL Server was last started?

When ever SQL Server is (re)started ‘TempDB’ gets recreated. So the below query should give us the time of when ‘SQL Server’ was last started. Select create_date from sys.databases where [name] = 'tempdb' When a SQL Server starts all the tasks which it initiates makes an entry in sysprocesses table with its ‘login time’. That said, all we need to do is find the least login_time which has got recorded in that table! 1. Select min(login_time) from master.dbo.sysprocesses OR 2. Select login_time from master.dbo.sysprocesses where spid = 1 OR 3. Select login_time from sys.dm_exec_sessions where session_id = 1 Technorati Tags: SQL Server

‘The Downfall’ of AGILE Hitler...

This one is hilarious :) I couldn’t stop laughing after watching this short cooked up movie. If you are in IT for atleast one year then you would love this as much as I did :)

Arithmetic overflow error converting IDENTITY to data type int.

Today I ran into the below error: Msg 8115, Level 16, State 1, Line 1 Arithmetic overflow error converting IDENTITY to data type int. Arithmetic overflow occurred. As the error suggests in the table the max limit of INT (2147483647) has reached. For the sake of people who haven't seen this error before let me simulate it. Create table MaxInt (   sno int identity ,   Fname varchar (30) ) Go ---Inserting my first record Insert into MaxInt values ('Sample') /* huh i can't insert billions of records like this and show :) Let me Reseed to last few numbers */ DBCC CHECKIDENT ( MaxInt, ReSeed, 2147483646) --Try inserting a record. It would Insert into MaxInt values ('Vadivel') /* Trying to insert another one .... now you would see the error mentioned above as we have reached the max of INT already */ Insert into MaxInt values ('Vadivel') Select * from MaxInt ...

Google’s ROBO …

Only yesterday I came to know that we can add webtoim@gmail.com to our Gtalk contact list and start chatting with that BOT. I understand that now, instead of Googling and digging Wikipedia for the correct answer, you can take assistance from the WebToIM Bot that is designed to answer such questions. Few of my observations: 1. Almost for all questions it starts answering as ”hmm…” which looks odd to me. 2. Very often even for basic questions (or) for questions for which I would get the answer by googling is throwing me “Sorry. I couldn't understand what you are asking. Please rephrase.” 3. I tried the following queries “Whats your age” it said sorry. I rephrased it as “What is your age” it again said sorry. Finally I asked “How old are you?” and it answered hmmm... 3 years and 9 months old 4. I got this response quite often as well hmmm... I found ...

Microsoft Surface Computing …

Check out these videos to understand about Microsoft Surface computing. Both the videos are really cool I loved it thoroughly.   Technorati Tags: Microsoft Surface Computing

Blocking unwanted sites using your HOST file…

For past few days my laptop got quite a few malwares / virus. I somehow got it cleaned using few free anti-virus softwares / with the help of various articles in the Internet. During the course of research!!! I stumbled upon a very interesting article on how to make use of your HOST file to protect your machine. Check out http://www.mvps.org/winhelp2002/hosts.htm This Host file for Windows, has entries to block ads, banners, 3rd party Cookies, 3rd party page counters, web bugs, and even most web browser hijackers. This is accomplished by blocking the internet connection to malware sites. But one thing which I have noticed as of now is my laptop has become slightly slower after replacing my old HOST file with the new file given in that site. I opened the HOST file and OMG there are hundreds of malware/ad related website listed there. I am not sure how they managed to collect all these address :) Technorati Tags: HOST file

Avoid using functions in WHERE Clause!!

Thumb Rule is as much as possible avoid using FUNCTIONS within WHERE Clause of your SQL Query. Let me show you some very basic examples to substantiate this theory. --Table schema Create table tblDateExample (dtStartDate datetime) Go -- Populate dummy records into the table INSERT tblDateExample VALUES ('2009-04-15 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-14 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-13 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-12 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-11 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-11 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-11 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-11 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-10 12:00:00.000') INSERT tblDateExample VALUES ('2009-04-09 12:00:00.000') INSERT t...