Month: March 2015

Mephobia

Fear of becoming so awesome that the human race can’t handle it and everyone dies. Advertisements

The Real Story of the Modern Day Developer

Every day thousands and thousands of developers fight stress, anxiety, deadlines, pressure, guilt, hard work. They give their everything so that they make the world a better place….These are their stories…

Value and Reference / In Depth

Whatever you do in the .NET framework deals either with value or reference types, yet, there seems to be a great deal of confusion in many discussions with fellow developers and on online forums and QA sites about where the […]

Code Analysis with NDepend

When our projects reach a certain size it is very hard to determine the complexity of our code. It gets harder and harder to see the overall picture. It also becomes very easy to introduce unnecessary complexity to parts of […]

Find Stored Procedure by Name

There are several ways to find a stored procedure in the server by name: we can query sys.procedures, syscomments, or information_scema.routines. Respective examples would be: or or

The Story of the Modern Day Developer

Software Developer, a “Programmer” even an “Engineer” or a “Craftsman“, although there are substantial differences between these according to some people, when we say any of them we mean one thing….an organism that transforms coffee into code 🙂 so I […]

Sql Server: datetime vs datetime2 recap

The MSDN documentation for datetime recommends using datetime2. datetime2 has larger date range, a larger default fractional precision, and optional user-specified precision. Also depending on the user-specified precision it may use less storage. Furthermore, datetime2 has a date range of […]

Get all stored procedures related to a table

To get all stored procedures related to a table: Option 1: SELECT DISTINCT so.name FROM syscomments sc INNER JOIN sysobjects so ON sc.id=so.id WHERE sc.TEXT LIKE ‘%tablename%’ Option2: SELECT DISTINCT o.name, o.xtype FROM syscomments c INNER JOIN sysobjects o ON […]

Sql Server: Delete duplicate rows with CTE

Here’s a code snippet to remove duplicate rows in a table: WITH CTE (Column1, Column2, DuplicateCount) AS ( SELECT Column1,Column2, ROW_NUMBER() OVER(PARTITION BY Column1,Column2 ORDER BY Column1) AS DuplicateCount FROM TheTable ) DELETE FROM CTE WHERE DuplicateCount > 1 GO […]

Filtering duplicates out of an IEnumerable

Problem: Filtering out(removing duplicates) from an IEnumerable One possible solution with using linq would be to group by key and take the first element of each group. Here’s an example: enumerable.GroupBy(x => x.key).Select(g => g.First())