April Fools’ Day is a day when people play practical jokes and hoaxes on each other. Why not trying to play some practical jokes on your friendly DBA 🙂

The first thing we are going to do is to spoof the host and program name. This is easy to do. Click on Connect, choose Database Engine, you will see the following box

Click on options >>

Click on the Additional Connection Parameters tab and paste in the following

Application Name=TOAD;Workstation ID=LarryEllison-PC

Now you can verify that what you have entered is returned from SQL Server

T-SQL
1
2
3
SELECT host_name,program_name 
FROM  sys.dm_exec_sessions
WHERE session_id = @@spid
SELECT host_name,program_name 
FROM  sys.dm_exec_sessions
WHERE session_id = @@spid

host_name	    program_name
LarryEllison-PC	    TOAD

If the DBA monitors the connection he might notice…..if not, time for plan B

Kick it up a notch….or two

Time to become real evil 🙂
Find out what the biggest table is in your company. Create a database with the same name on your local instance and also create the same table. Now it is time to create a panic.
Open another connect dialog box, add the real server in the Server Name box, for example I entered PDWSQLServer2015

Click on options >>, click on the Additional Connection Parameters tab and paste in the following Data Source=localhost

Just to verify, run the following query

T-SQL
1
SELECT @@SERVERNAME
SELECT @@SERVERNAME

That returns you the local servername. Look what you see everywhere else (highlighted in yellow)

I see PDWSQLServer2015 everywhere else.
Now run your query which returns 0 rows

T-SQL
1
SELECT * FROM HugeTable
SELECT * FROM HugeTable

Call your DBA to stop by and then ask him if he deleted all 3 billion rows from this table? Look at his face..let him run sp_spaceused 'HugeTable'. Once the panic sets in tell him he has be pranked…….

Of course there is a chance that all your permissions will be taken away…..