Friday, 8 July 2011

SQLPeople: I'm a SQL Person!!

Thursday the 7th July 2011 was a big day for me. I officially became a SQL Person. No, its not the first time I had a job whose core responsibilities revolved around SQL Server nor even the first time i'd written a SQL query. No, this was the day when I had my interview published on SQLPeople

SQLPeople is the brainchild of Andy Leonard (Blog | Twitter) and is a project for the SQL community. The SQL community is a vibrant, rewarding and educational group to be a part of and SQLPeople adds yet another dimension. At the moment, its principally a series of blogs about people within the SQL community and an opportunity to put some personality around those guys who you may only ever see in the context of the MSDN Forums, Blogs or #SQLHelp. However, I can see this concept growing and growing and I believe there has already been a first event in the US. Andy has done a great job.

I'm proud to be a part of SQLPeople and its reaffirmation that working in the SQL Server arena can be a rewarding experience.

Read my interview here.

Thursday, 7 July 2011

Powershell: List Local Users & Groups

I recently encountered a permissions issue on SQL Server, the route cause of which was a user being removed from a local windows group on a production server. This got me thinking of yet another use for Powershell, to list out the local users and groups on a particular server.

ListLocalGroupMembership.ps1
$computerName = Read-Host 'Enter computer name or press <Enter> for localhost'  
  
if ($computerName -eq "") {$computerName = "$env:computername"}
$computer
= [ADSI]"WinNT://$computerName,computer"
$groups = $computer.psbase.Children | Where-object { $_.psbase.schemaclassname -eq 'group' }

foreach ($group in $groups)
{
   $users
= $group.psbase.invoke("Members")
  
$group.name
   write
-host "----------------------------------------------------"

  
if ($users -ne $null)
  
{
      
foreach ($user in $users)
      
{
           $user.GetType
().InvokeMember("Name","GetProperty",$null,$user,$null)
      
}
   }
  
else
  
{
       write
-host "-----EMPTY-----" -foreground "red"
  
}

   write
-host "----------------------------------------------------"
  
write-host ""
}


The basis of this script was taken from here.

You could easily take this a stage further and log this data to a repository and then alert any changes made.

Tuesday, 5 July 2011

Denali: SSMS has Improved look and feel

One of the first things I noticed with the new version of SQL Server (Denali) was the changes to Management Studio and the development experience. While not as ground breaking as the move from Query Analyzer to SSMS when SQL 2005 was released, there is definitely further movement towards a common development platform for programmers.

Here is the initial splash page you get when booting up SSMS:



The main thing I noted here was the comment in the bottom right corner which explicitly states "Powered by Visual Studio". To me, this is a clear indication of the direction MS is heading with its database toolset.

And here we have a shot of what using SSMS for development looks like:



Notice here how we have much more varied colour coding for keywords, specifically variables and object names. This is a vast improvement on the generic black text in previous versions. Another feature you can see here is the bottom left of the shot above the results pane - a zoom dropdown allowing you to quickly increase the size of the text in your query window. There is also one for the results pane, although this shot doesn't show it.

Development Environment Convergence

We've already seen Visual Studio creeping into the SQL Server arena with the Business Intelligence Development Studio (BIDS) which is essentially the VS shell with SQL Server plugged in and I can see MS trying to consolidate their development environments still further. This makes a lot of sense for software devs who will often be developing database enabled applications and need to flit between their .Net code and database code. Having a more uniform and familiar environment makes the experience that much smoother and hopefully more efficient.
/* add this crazy stuff in so i can use syntax highlighter