Posts

Showing posts from 2013

Get a List of all Installed Programs (and Updates) from cmd

Image
This is the list that most of us need at times. For me, the scenario was I needed to compare the softwares installed on two boxes. Alright then, lets go step by step 1. Open Command Prompt on your machine. 2. To display the list of All Programs installed, go on with WMIC  product get name,version You'll get this 3. To export this list to a text file, use the following command. wmic /output:d:\ProgramList.txt product get name,version The output will be somewhat, 4. To get a list of installed updates WMIC  /output:d:\UpdatelList.txt QFE get Thats all for the day :)

Start a Service on Remote Computer using Command Prompt

Image
Many a times we don't want to RDP a system just to start or stop a sevice. In these times we can use this command from cmd, sc <machine name> start\stop <name of Service> e.g. sc \\tstsystem start SQLSERVERAGENT So, no need to RDP any further for petty tasks :-) Will keep you posted.

Check who modified the Stored Procedures in a Database

use <database name> SELECT name, create_date, modify_date FROM sys.objects WHERE type = 'P' order by modify_date desc

Difference between a Thread and a Process.

A process is an executing instance of an application. For example, when you double-click the Microsoft Word icon, you start a process that runs Word. A thread is a path of execution  within a process. Also, a process can contain multiple threads. When you start Word, the operating system creates a process and begins executing the primary thread of that process. It’s important to note that a thread can do anything a process can do. But since a process can consist of multiple threads, a thread could be considered a ‘lightweight’ process. Thus, the essential difference between a thread and a process is the work that each one is used to accomplish. Threads are used for small tasks, whereas processes are used for more ‘heavyweight’ tasks – basically the execution of applications. Another difference between a thread and a process is that threads within the same process share the same address space, whereas different processes do not. This allows threads to read from and write to ...

VS 2012: No exports were found that match the constraint : ContractName

Image
This morning, one of the fellow developers shared the issue. He was getting the error below while opening any of the files: And some other guys came up with the same thing. I tried to find the root cause, was unable to do so. I'll update this post if I find that. However, there is good news. I've got the solution: Resolution steps are ; -Close Visual Studio - Go to the location C:\Users\ navdeep \AppData\Local\Microsoft\VisualStudio\11.0 (replace navdeep with your user id) - Delete the folder ComponentModelCache. - Start Visual Studio It builds the component cache and the things are working again  :-)

Delete a file without moving it to Recycle Bin

Image
Hi All I just faced a problem with deleting the files. Shift + Delete was still using the recycle bin. However, the space available over the drive was 0 KB. Hence the deletion was not possible. Alternative way : Right Click on the Recycle Bin, and click on Properties: Use the second radio button for the drive intended. And we're good to go :)

Find out when was a Stored Procedure Modified

Most often , when we leave the office, the things are working fine. However, we join in the morning only to discover certain things are not working. The build you deployed yesterday had all the things up and running. At times , the issue can be with the back end. Somebody modified a stored procedure last night, maybe. If you doubt such a scenario, query below might some in handy: use [name of the database] SELECT name, create_date, modify_date  FROM sys.objects WHERE type = 'P'  order by modify_date desc this will give you all those Stored Procedures that have been modified since creation.

Setting up Trace in SQL Server 2012 to track the deletion in a Table

Image
Hi Everyone Today we'll be going through one of the issues I faced at my workplace. The issue was that records were being deleted from the DB table. Only service I knew was inserting records into the Table. Basically, in such scenario, we use the SQL Server Profiler. This is available in the Menu of Performance Tools under SQL Server 2012. Open the profiler: Click File >> New Trace. This will ask for the server against which you want to run the trace. Enter the Server Instance and the credentials. This will open up the Trace Properties Window. Use the Standard Template for the moment You can save the trace data to a file with a .trc extension. However, better approach can be saving to a database table. This all depends upon personal preference. Also, the trace can be time based. You can mention a time at which the trace ends. This is quite necessary as the trace can be quite resource consuming at times. Now, go to t...

Error: this template attempted to load component assembly 'NuGet.VisualStudio.Interop, Version=*, Culture=neutral, PublicKeyToken=*' - blah blah

Image
Error: this template attempted to load component assembly 'NuGet.VisualStudio.Interop, Version=*, Culture=neutral, PublicKeyToken=*'. For more information on this problem and how to enable this template, please see documentation on Customizing Project Templates. I was getting this error in newly released and installed Visual Studio 2012 Ultimate on my system when I tried to create any Web Application. Possible Solution: i) Open Visual Studio > Tools > Extensions and Updates > select 'NuGet Package Manager' and uninstall it. ii)  Open Visual Studio > Tools > Extensions and Updates > select 'NuGet Package Manager' and install it. iii) And whoop, the error's gone

Check which databases have been restored in last n number of days

DECLARE @dbname sysname, @days int SET @dbname = null --substitute for whatever database name you want, null will fetch for all the databases SET @days = -n --substitute n with previous number of days, script will default to 30 SELECT  rsh.destination_database_name AS [Database],  rsh.user_name AS [Restored By],  CASE WHEN rsh.restore_type = 'D' THEN 'Database'   WHEN rsh.restore_type = 'F' THEN 'File'   WHEN rsh.restore_type = 'G' THEN 'Filegroup'   WHEN rsh.restore_type = 'I' THEN 'Differential'   WHEN rsh.restore_type = 'L' THEN 'Log'   WHEN rsh.restore_type = 'V' THEN 'Verifyonly'   WHEN rsh.restore_type = 'R' THEN 'Revert'   ELSE rsh.restore_type   END AS [Restore Type],  rsh.restore_date AS [Restore Started],  bmf.physical_device_name AS [Restored From],   rf.destination_phys_name AS [Restored To] FROM msdb.dbo.restorehistory rsh INNER JOIN ...