Change varchar column length, when column does not match given length in T-SQL.

The following code will update a column to varchar(max) only, when it does not already have the varchar(max) length.

-- Update column 'Name' length, it should be varchar(max).
-- Note: varchar(max) has length '-1'.
if (    
select character_maximum_length
from information_schema.columns
where table_name=object_name(object_id('dbo.Table1'))
and COLUMN_NAME = 'Name'
) <> -1
alter table dbo.Table1 alter column Name varchar(max) not null

How to get the amount of elapsed minutes in current quarter in T-SQL

If you want to know the amount of elapsed minutes in the current quarter, you can use the following T-SQL code:

declare @CurrentDateTime datetime = '2014-03-27 10:56:10'
declare @MinutesPassedInHour int = convert(int, datepart(minute, @CurrentDateTime))
declare @quarterCount int = @MinutesPassedInHour / 15
declare @MinutesPassedInQuarter int = (@MinutesPassedInHour - (@quarterCount * 15))
select @MinutesPassedInQuarter
-- Result: 11

Solving: The working folder … is already in use by the workspace … on computer … In Visual Studio 2013

When mapping a collection to a local folder in Microsoft Visual Studio 2013, I was getting the error:

The working folder … is already in use by the workspace … on computer …




To solve this problem I had to delete the workspace:

  1. Close Microsoft Visual Studio 2013.
  2. Open en command prompt in Administrator mode.
  3. cd "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE"
  4. tf workspace /delete /server: MyComputerName;MyDomain\MyUserName
  5. Open Microsoft Visual Studio 2013. Mapping to local folder should now work.


For more information:


To list all workspace use:

tf workspaces /owner:* /computer:* /server:

To list detailed information on all workspaces, use:

tf workspaces /server: /computer:MyComputerName /owner:* /format:detailed



In a specific case, deleting the workspace on the client was not enough. I had to execute the same command on the TFS server itself to delete both the client and de server workspace.

Disable Application Cache during development on IIS.

In production we use Application Cache, to distribute a new version of a Single Page Application.

In development I immediately want to see my CSS, JavaScript and HTML code changes, without changing the “*.appcache” on every save. This is why I disable de Application Cache in development by “not serving” the “*.appcache” file:

<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" />
<!-- To disable appCache during development, comment line above and uncomment line below. -->
<!--<mimeMap fileExtension=".wrongAppcache" mimeType="text/cache-manifest" />-->