Entries by Twan Jacobs

Arogl Darthu's Blog

  • Homepage

Nov 12: Quirks of LEN

As we all know, the LEN function in T-SQL returns the character length and at that ignores the trailing blanks... So, how to return the length including these trailing blanks? I experimented a little and found that all you have to do is CAST to the appropriate MAXed variant of your datatype. So just try the following:

DECLARE @l_nContentMax NVARCHAR(MAX)
,       @l_nContent    NVARCHAR(20)

SELECT @l_nContentMax = '1234567890     ' -- character length = 15
,      @l_nContent    = '1234567890     ' -- character length = 15

SELECT LEN(N'1234567890     ')                        AS Plain
,      LEN(CAST(N'1234567890     ' AS NVARCHAR(MAX))) AS MaxCast
,      LEN(@l_nContent)                               AS PlainVariable
,      LEN(@l_nContentMax)                            AS MaxVariable
 
This results in:
T-Sql Results

So... just cast your expression to NVARCHAR(MAX) or VARCHAR(MAX) where appropriate and you'll get the right length ;-)
Posted by Twan Jacobs Comments: (0) Trackbacks: (0)

Jun 18: TF31002

Unable to connect to this Team Foundation Server...

Microsoft Visual Studio 2005 pops up a nice dialog with three possible reasons for failure:

  • The Team Foundation Server name, port number or protocol is incorrect.
  • The Team Foundation Server is offline.
  • Password is expired or incorrect.
They should have added: Your machine.config contains an error. In this case a coworker added an appSettings section to the machine.config. He added valid xml; no errors at all. So why blame the config settings you might ask...

Well, apparently the appSettings node must be located below the configSections node. If not, all kind of strange things (like not being able to connect to TFS) will occur.
Posted by Twan Jacobs in WTF Comments: (0) Trackbacks: (0)

Feb 23: BIOS IDE Detection Hell

OK, I admit... It's been a while since I put together a PC. But this is really too weird. At startup, even before having an OS installed, there was a tremendous delay when the BIOS tried to detect the IDE devices. Just two, a hard disk drive on the primary and a CDROM on the secondary. How hard can that be to detect?

Well appearently very hard, because the waiting started to bother me from the first boot I had to make. So you start tweaking the BIOS settings. The BIOS Optimization Guide seemed a good place to start. But allas, whatever I tried it was of no use.

Hours later, after searching the web for known issues with my drives and/or mobo, I finally keyed the right phrase into google and asked 'slow boot in bios'. And there my answer was, only one click and some scrolling away. Googles first result, opened a discussion thread called 'Slow Booting' and hidden under 'Response Number 6' I found what I was looking for.

Hold on: the jumpers on the IDE devices need to be set to cable select. The setting master is not good enough anymore. Why, why, WHY!?
Posted by Twan Jacobs in Infra Comments: (6) Trackbacks: (0)
« previous page   (Page 3 of 5, totaling 14 entries)   next page »

Calendar

Back May '12
Mo Tu We Th Fr Sa Su
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Archives

  • May 2012
  • April 2012
  • March 2012
  • Recent...
  • Older...

Categories

  • XML BizTalk
  • XML C#
  • XML Daily Didst
  • XML Infra
  • XML SQL
  • XML WCF
  • XML WTF


All categories

Syndicate This Blog

  • XML RSS 2.0 feed
  • XML RSS 2.0 Comments

Blog Administration

Open login screen

Powered by

Serendipity PHP Weblog
 

Layout by Andreas Viklund | Serendipity template by Carl