Get DATETIME value from msdb.dbo.sysjobhistory

If you ever had to work with SQL Job Agent and find out the details about run time for the job/step, you would find it difficult to convert the INT into DATETIME. Here is the quick solution. To get the start date time, use msdb.dbo.agent_datetime function available in SQL Server 2005 onwards. If you are… Read More »

Stop SQL Server trace using SQL command

Today I started SQL Profiler and paused it. After some time, none of the buttons were enabled. I can neither resume nor stop the trace. Here are the sql commands that I finally found to stop the trace. 1) Get the trace id 2) Stop trace

Change Database Name in SQL Server

SQL Server Enterprise Manager does not let you change your database name once you create it. If you want to change your database name, you may have to manually run the following script to change it. First of all you have to login to SQL Server using osql command line utility. Once you are in,… Read More »