Skip to content
February 27, 2009 / Steven Pousty

VSLive09 – SQL Server 2008 for developers

Leonard Lobel is the presenter – He is a doing a good job showing demos and covering  just the right amount of details in slides. Striking a good balance between new features and basic understanding. Talks a bit fast, so sometimes I fall behind.

Got in late. SQL Server 2008 studio has some very nice features

Table defined types, table valued paramter (TVP) gives you the ability to define a variable which is actual a whole table (like a temp table) with a schema defined.  They are stored tempdb (so a bit slower than CTE or table variable) but it can be indexed. Use case is something like an order table because you can flatten the schema for the header and order items. Instead of going round trip for each piece you can create a table with one call. Demo time

Very very nice! Quick and easy to get results and much less chat across the wire with a client.

Once you pass it – it is read only once you pass it down the stack. THere is no ALTER TABLE… AS TYPE so you need to drop it as well as the stored procedures

Next Topic – MERGE

Four statements in one

  • select
  • insert
  • update
  • delete

Operates on a join but you didn’t need to know about it

Start using it now – 100% compat with existing business logic, such as triggers

OUTPUT is for getting psuedo-tables after an operation
OUTPUT $action, inserted.*, deleted.*;

Demo time – he is showing how to do replication and it is really tight and interesting to watch.  Give me more kool-aid

He does a nice demo for updating data and it looks really good – just too much to follow and he is talking a bit too fast.


Look at with Roll up and CUBE – frickin awesome great for summarization – produces sum for all possible combinations

new is GROUPING SETS – basically does it just for the category you ask for

SQL Server does Cubes right out of the box.

GROUPING helps to deal with distinguising between Nulls and All possible values rolled up

To get this from ORM you would need to use a view or something like that. We then had a short detour on when you might use TSQL vs ORM. He says doing reporting like this might be a place where you might want to use TSQL but he understands the conlict there.

BIG BENEFIT TO VSLive – IT IS NOT MS Conference so the presenters are not as kool-aid driven, much more frank conversation and discussion of pitfalls

New Date and Time variable

  • Date
  • Time
  • datetime2
  • datetimeoffset

use these instead of

  • datetime
  • smalldatetime

Some more about writing code and insulation between layer

He likes DataSets unless you need to serialize them. He thinks they are good for most people and don’t think you really need ORM. DataSets are not slower than DataReaders

He believes developers should only query against stored procedures – no access directly to the tables.  For numerous reasons he then delimits the reasons – wow that is bit harsh but interesting to think about. He argues that with a where clause in LINQ, is that you pull back all the data and then filter on the client and why would you want to do that.

On to LINQ

LINQ is really a way to deal with collections to datasource and vice versa in a standard language. Trying to get rid of all these For loops where you process something to get a Collection of data objects.

On to LINQ to DataSet – look in System.Data.DataSetExtensions assembly

He says if you are starting new he says go to Entity framework – it is much more of an ORM mapper

Watching him decorate a Plain Old C# Object (POCO) with LINQ attributes and then doing really cool things. This is actually pretty neat stuff. As a person who doesn’t usually get into performance issues because of low transaction numbers, I am going to mostly go down this route.

He concludes morning session on stating – LINQ is going to be with us for a while and you better dig in. Some providers are better than other but you better learn it.

More to come after lunch!!! THis is a great session


One Comment

Leave a Comment
  1. asava samuel / Mar 5 2013 11:48 am

    Here is an ORM that works with SQL Server

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: