Wednesday 9 November 2011

Physical Servers What are They?

Today I'm in the process of installing some physical servers.  To put this into perspective due to the companies I have worked for over the last few years adopting virtualisation I haven't installed Windows Server let alone commission a physical server from sysprep up.


Imagine then being asked to connect from my office in Manchester to Integrated Lights Out (ilo) on a server in a data centre in London then install Windows from an iso in another data centre across a highly contended line!  I've been going for 3 hours now and am only at Expanding Files (0%)...  Virtualisation offers many benefits but one which I have taken for granted is the speed and ease with which a new server can be commissioned.


Has anyone taken on a task in a physical environment recently that virtualisation has made so much quicker / easier?


Expanding Files has just changed to (1%)... ;-)


Chris

Tuesday 8 November 2011

CONVERT Dates and Confusion

Right I've been itching to post another Blog and actually contribute something this time.  This isn't something I've learned but something I've taught many times in the past.


It can't be just me but I get asked a lot about the formatting of dates especially for reports.


This is something that is almost always over complicated and misunderstood, one table in BOL covers it.  Search for 'CONVERT function' and the first remark is 'Date and Time Styles'.  This table gives you certainly every date format I have ever had to use and more.  My particular favourite is ISO 112 it confuses the hell out of people when you use it on a form, but that's just my inner geek coming out.


I've included a selection of the most common conversions I have used in the past in the below T-SQL



-- Month first  
SELECT CONVERT(VARCHAR(12),GETDATE(), 101)  -- 11/08/2011
SELECT CONVERT(VARCHAR(12),GETDATE(), 110)  -- 11-08-2011
SELECT CONVERT(VARCHAR(12),GETDATE(), 100)  -- Nov  8 2011 
SELECT CONVERT(VARCHAR(12),GETDATE(), 107)  -- Nov 08, 2011


-- Year first  
SELECT CONVERT(VARCHAR(12),GETDATE(), 102)  -- 2011.11.08
SELECT CONVERT(VARCHAR(12),GETDATE(), 111)  -- 2011/11/08
SELECT CONVERT(VARCHAR(12),GETDATE(), 112)  -- 20111108
   
-- Day first  
SELECT CONVERT(VARCHAR(12),GETDATE(), 103)  -- 08/11/2011 
SELECT CONVERT(VARCHAR(12),GETDATE(), 105)  -- 08-11-2011 
SELECT CONVERT(VARCHAR(12),GETDATE(), 104)  -- 08.11.2011
SELECT CONVERT(VARCHAR(12),GETDATE(), 106)  -- 08 Nov 2011 
   
-- Time only  
SELECT CONVERT(VARCHAR(12),GETDATE(), 108)  -- November
SELECT CONVERT(VARCHAR(12),GETDATE(), 114)  -- 14:36:14:043


SELECT DATENAME(MONTH, GETDATE()) -- September 
SELECT DATENAME(DAY,GETDATE()) -- 8  
SELECT DATENAME(YEAR, GETDATE()) -- 2011  


-- Concatente values  
-- November-8-2011
SELECT DATENAME(MONTH, GETDATE()) + '-' + DATENAME(DAY,GETDATE()) + '-' + DATENAME(YEAR, GETDATE()) 


Enjoy, Chris!

Monday 7 November 2011

My First Blog Post!

So here it is then, my first ever Blog post!


I'm not cheating here as I am not officially starting to post the 365 things I learn about SQL Server until 1st January 2012!


Last week I started a new job and am now a Database Administrator for Experian QAS.  This is a fantastic opportunity for me to further my career and practice what I have learned over the years to help drive QAS' SQL Server estate forward as best I can.


Watch this space as I will soon be embarking on my voyage of SQL Server discovery!


Chris