Tuesday, November 19, 2013

Speaking at Data Modeling Zone 2014

My boss, Ryan Smith, and I will co-present on modeling in NoSQL at Data Modeling Zone 2014 here in Portland.

It's not until October of next year, so we don't have things nailed down yet, but it will be fun to work with Ryan on this.

RESTful Service Best Practices

I was recently looking for reference material to back up my preference for storing date/time values in MongoDB in UTC using MongoDB's ISODate type. I found this great reference published at amazonaws.com:

RESTful Service Best Practices
Recommendations for Creating Web Services

It gives a solid recommendation for RESTful services:
"... always use the same format, including the time portion (along with timezone information) in the string. ISO 8601 time point format is a good solution, using the fully-enhanced format that includes hours, minutes, seconds and a decimal fraction of seconds (e.g. yyyy-MM-dd'T'HH:mm:ss.SSS'Z')."
It doesn't directly address storage directly, but it's such a great resource, I wanted to share it.

Wednesday, October 30, 2013

Exploring SQL Server 2012's sys.dm_exec_describe_first_result_set_for_object()

SQL Server 2012 introduces sys.dm_exec_describe_first_result_set_for_object(). The official documentation is here.

Let's work through some examples to discover what this new function delivers.

First, build a table that will be used to illustrate the function:
CREATE TABLE dbo.TestTable (
    
ColID       INT                     IDENTITY,
    
ColStr      CHAR(10)                NOT NULL,
    
ColMod              AS ColID % 10,
    
ColDef      bit                     NOT NULL    DEFAULT 0,
    
ColCalc0    INT                     NULL,
    
ColDec      DECIMAL(3,2)            NULL,
    
CONSTRAINT UIX_Test1_ColStr UNIQUE (ColStr)
);

Then build the simplest possible stored procedure that references that table:
CREATE PROCEDURE dbo.SimpleProc AS
SELECT
ColID FROM dbo.TestTable;

Now call the function:
SELECT * 
FROM sys.dm_exec_describe_first_result_set_for_object (
    
OBJECT_ID('dbo.SimpleProc'),
    
0

);

Remember that this stored procedures selects only one column. There are many columns in the result set. Here are some of the more interesting ones:
is_hidden:                0
column_ordinal:           1
is_nullable:              0
system_type_name:         INT
is_identity_column:       1
is_updateable:            0
is_computed_column:       0
ordinal_in_order_by_list: NULL
order_by_is_descending:   NULL
asdf






MongoDB Training

I am in the middle of taking a free on-line class: "M102: MongoDB for DBAs".

Very interesting and educational so far. Also a bit frustrating. As I don't have a background in JavaScript, there are certain parts of the class that I struggle with.

In general though, this is a great class and well worth your time if you are interested in MongoDB.