Posts

Showing posts from 2009

SSMS handy short cut keys

Image
In Microsoft SQL Server Management Studio, its handy to have some short cut keys to do common tasks. One handy one I always use is to " select top 100 * from " as I like to highlight a table name and press CTRL+4 to get the top 100 rows instantly. To set this up, go to Tools->Options->Keyboard. And type "select top 100 * from " without the quotes and making sure you add a space after the from. Very important to leave a space at the end. Highlight a table and press Ctrl+4 and the top 100 rows will be shown. SSMS will run your command and append the highlighted text. If your table is called USERS, it would run "select top 100 * from USERS". If you forgot to leave a space at the end, it would try and run "select top 100 * fromUSERS" which won't work.

table-values functions. Make sure you write them as inline.

Here is a multi-line statement (slow): CREATE FUNCTION dbo.fnSomeReport ( @someParam INT , @field_company_id INT = NULL ) RETURNS @result TABLE ( [field_company_name] VARCHAR (255), [engineer] VARCHAR (100), [sku] VARCHAR (30) ) AS BEGIN INSERT INTO @result ( [field_company_name], [engineer], [sku] ) SELECT field_company_name, engineer, sku FROM ... WHERE ID > someParam AND (@field_company_id IS NULL OR field_company_id = @field_company_id) RETURN END GO Now as an inline statement (fast) CREATE FUNCTION dbo.fnSomeReport ( @someParam INT , @field_company_id INT = NULL ) RETURNS TABLE AS RETURN ( SELECT field_company_name, engineer, sku FROM ... WHERE ID > someParam AND (@field_company_id IS NULL OR field_company_id = @field_company_id) ) GO Right then whats going on and what the hell is all the fuss about anyway? The query optimizer expands the function as if it was a macro, and generates the plan as if you had provided the expanded query . Thus, there is no performance cost ...

PLINQO - Get it, use it, love it

I've stumbled across a LINQ to SQL extension called PLINQO freely downloadable at http://plinqo.com/ and includes source code. PLINQO is a set of CodeSmith templates that generates code for you around your LINQ to SQL DBML file. It generates Manager classes and Query classes automatically (it does this by looking at your primary keys, indexes and foreign key constraints). You must buy CodeSmith , which is the template engine, but PLINQO is free. Its actually quite amazing and saves you tons of time and energy creating boiler plate code. So glad I found it, now I want you to investigate it too. Go check out the video tutorials to see what I mean. Awesome .

Virtual Machine Key Combinations with Hyper-V

Taken from here and kept for prosperity incase the information was ever lost. So all credit for the following information goes to Ben Armstrong . Standard Windows Key combination Virtual Machine Connection Key Combination Explanation CTRL + ALT + DEL CTRL + ALT + END Displays the Task Manager or Windows Security dialog box on Windows (or logs in). ALT + TAB ALT + PAGE UP Switches between programs from left to right. ALT + SHIFT + TAB ALT + PAGE DOWN Switches between programs from right to left. ALT + ESC ALT + INSERT Cycles through the programs in the order they were started. CTRL + ESC ALT + HOME Displays the Windows Start menu. N/A CTRL + ALT + PAUSE Changes the Virtual Machine Connection window to / from full screen mode. N/A CT...

Execution of user code in the .NET Framework is disabled

I was testing our new SQL Server 2008 enterprise cluster today and managed to get the following SqlException running a C# application: "Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option. The statement has been terminated." The solution is to run the following: EXEC sp_configure 'show advanced options' , '1' ; go RECONFIGURE ; go EXEC sp_configure 'clr enabled' , '1' go RECONFIGURE ; -- Turn advanced options back off -- EXEC sp_configure 'show advanced options' , '0'; GO

Web Deployment Tool 1.0 has shipped

After 2 years of development and lots of customer feedback, the Web Deployment Tool has shipped the RTW of version 1.0 Click here to be taken to the IIS Blog. Click here to be taken to the download site.

I love the Linq to REST capability

All without changes to your C# code at all. Awsome. Just watched Scott Hanselman's ADO.NET Data Services talk from NDC09. Rather good, so go watch. Given that it (ADO.NET Data Services) is agnostic of EntityFramework, Ling2Sql, NHibernate, or MyHomeGrownOrm, seems like a good basis for implementing simple CRUD style services. Looking at it I can see the appeal and its a good way to go. You could easily plug in a mock objects with test data pretending to be your database for NUnit testing your code with ease.

Windows Server 2008 as a Workstation

Image
Well, its well known that Windows Server 2008 is 11-19% faster than Vista, and its using the Vista kernel. There's a ton of articles and i'm not going to list them here. But what I am going to show you is how to do it. Quoting from Alex Zaharov-Reutt Although using server versions of Windows as desktop/workstation versions over the years certainly isn’t new, the source of the latest drive to turn Windows Server 2008 into Windows Workstation Vista 2008 seems to have come from Microsoft employee Vijayshinva Karnure, in his blog “The Way I See It”. Karnure works at Microsoft India, and in a blog entry called “Using Windows Server 2008 as a SUPER workstation OS”, and in a follow up “Cont’d” posting, he outlined what Server 2008 users need to do to enable all the Vista-esque workstation goodness. Another website called “Convert your Windows Server 2008 to a Workstation!” offers a “Windows Server 2008 to Workstation Manual”. Reasons why Server 2008 might be faster include the l...