Friday, May 30, 2014

[WAT] more screwy date conversion

So, let's convert some dates

DECLARE @my_month DATETIME = '20140530'
SELECT SUBSTRING(CAST(@my_month AS VARCHAR(8)), 5, 2) + '/01/' + SUBSTRING(CAST(@my_month AS VARCHAR(8)), 1, 4)

Returns:
30/01/May

But what if we set that date to an Int?
DECLARE @my_month int = '20140530'
SELECT SUBSTRING(CAST(@my_month AS VARCHAR(8)), 5, 2) + '/01/' + SUBSTRING(CAST(@my_month AS VARCHAR(8)), 1, 4)

Returns:
05/01/2014


Monday, May 12, 2014

SQL Saturday 308 - SQL Watchdog - scripts and slide deck

Someone mentioned a problem with the scripts being corrupt on the SQL Saturday website.  Here's a copy of my most recent presentation.  All the scripts, including the repository creation scripts (zip-within-the-zip). 

Holler if you have any questions, thanks again to Nancy and Allen for allowing me to present and treating us like rockstars, and thanks to everyone who attended SQL Saturday Houston!

TBD

https://drive.google.com/file/d/0B3a287PS_UJIRDJBNWEtNVBJY0E/edit?usp=sharing

and the whole folder of goodies (old versions, warts and all) is available at:
https://drive.google.com/folderview?id=0B3a287PS_UJIcnY3Q1pvX3p1eEE&usp=sharing

Saturday, May 10, 2014

[Event Notifications] Hekaton prevents EN?!

Nooooooooooooo...

http://msdn.microsoft.com/en-us/library/dn246937(v=sql.120).aspx

Memory-optimized tables and natively compiled stored procedures cannot be created or dropped if there is a server or database event notification for that DDL operation. Remove the server and database event notifications on CREATE TABLE or DROP TABLE and CREATE PROCEDURE or DROP PROCEDURE.

What happens if you attempt to do it?

 Msg 10794, Level 16, State 124, Line 1
The feature 'EVENT NOTIFICATION' is not supported with memory optimized tables.



Why is this a big deal?  Because, honestly, I'm scared that if they're not supporting things like this, that EN is on its way out.  I use it extensively (see my presentations on it, coming soon to a SQL Saturday near you), and it's IMHO a must-have feature.  It also means that whenever we want to do something with Hekaton, we have to drop the EN, do the Hekaton-based changes, then we're less likely to use Hekaton or EN.  

Please vote on my Connect item:

https://connect.microsoft.com/SQLServer/feedback/details/874185/event-notification-please-make-in-memory-oltp-tables-natively-compiled-sps-work-with-en