Wednesday, March 05, 2008

Microsoft Announces SQL Server Data Services

What is Microsoft SQL Server Data Services?
SQL Server Data Service (SSDS) is a highly scalable and cost-effective on-demand data storage and query processing web service. It is built on robust SQL Server technologies and helps guarantees a business-ready service level agreement covering high availability, performance and security features. Microsoft SSDS is accessible using standards based protocols (SOAP, REST) for quick provisioning of on-demand data-driven & mashup applications.

How does Microsoft SQL Server Data Services differ from traditional on premise relational SQL Server Database?
SQL Server Data Services is a storage and query processing utility providing mega scale, high availability, reliability, and geo-distributed data services in the Cloud. Customers use the service on-demand, with no up-front cost. It eliminates the initial investment in hardware and software and the on-going cost for storage administration, scale maintenance. Developers and Service providers can quickly run their on-demand applications with minimal infrastructure cost.

What can I do with SQL Server Data Services?
Customers can use SQL Server Data Services to store virtually any amount of data in the Cloud. They can query and modify data as required by the specific business scenarios. SQL Server Data Services support standards-based REST and SOAP interfaces designed to work with any Internet-development toolkit. The primary wire format is XML. Developers and service providers can quickly run on-demand applications with ease. The data has flexible schema which can be modified dynamically by the application. The data is provided with high availability and reliability virtually anywhere, anytime.

Rest of the FAQs here: http://www.microsoft.com/sql/dataservices/faq.mspx
Main SQL Server Data Services site here: http://www.microsoft.com/sql/dataservices/default.mspx

Wednesday, February 27, 2008

In SQL Server 2008 The CONVERT function is enhanced to allow conversions between binary and character hexadecimal values

SQL Server 2008 CTP 6 has enhanced the convert function when you do conversion between binary and character hexadecimal values
There are 3 styles:
Style 0 works the same as on 2005 it converts binary to varchar, if you have 0x64656E6973 then you will get 'denis'
Style 1 converts binary to varchar but the values stay the same, if you have 0x64656E6973 you will get '0x64656E6973'
Style 2 strips the 0x but leaves the rest of the values, if you have 0x64656E6973 you will get '64656E6973'

Try it out

When you run this


SELECT CONVERT(varbinary(5),'denis')

The output will be this 0x64656E6973. Now we can use that in the select statements below


SELECT CONVERT(varchar(18), 0x64656E6973, 0) AS 'Style 0' --denis
SELECT CONVERT(varchar(18), 0x64656E6973, 1) AS 'Style 1' --0x64656E6973
SELECT CONVERT(varchar(18), 0x64656E6973, 2) AS 'Style 2' --64656E6973


When you run the code above on SQL Server 2005 all 3 select statements return 'denis'

It is all in Books On Line for CTP 6, it would have been nice if they also included the sys.dm_tran_commit_table dmv or the sys.dm_exec_trigger_stats dmv. I have no clue what the sys.dm_tran_commit_table dmv is supposed to do :-(

Thursday, February 21, 2008

46 New Dynamic Management Views In SQL Server 2008 CTP6

Remember the 33 new DMVs in SQL Server 2008 post? I was just poking around in SQL Server 2008  CTP6 and wanted to know if there were any new Dynamic Management Views since CTP5. There are 13 new DMVs in CTP6 and there are a total of 45 new Dynamic Management Views compared to SQL server 2005. The list of them is below, I think their names make clear what the dmv is supposed to do (or at least I think I know)




dm_audit_actions
dm_audit_class_type_map
dm_cdc_errors
dm_cdc_log_scan_sessions
dm_cryptographic_provider_algorithms
dm_cryptographic_provider_keys
dm_cryptographic_provider_properties
dm_cryptographic_provider_sessions
dm_database_encryption_keys
dm_db_mirroring_auto_page_repair
dm_db_mirroring_past_actions
dm_db_persisted_sku_features
dm_exec_procedure_stats
dm_exec_trigger_stats
dm_filestream_oob_handles
dm_filestream_oob_requests
dm_fts_fdhosts
dm_fts_index_keywords
dm_fts_index_keywords_by_document
dm_fts_outstanding_batches
dm_fts_parser
dm_os_dispatcher_pools
dm_os_dispatchers
dm_os_memory_brokers
dm_os_memory_node_access_stats
dm_os_memory_nodes
dm_os_nodes
dm_os_process_memory
dm_os_spinlock_stats
dm_os_sys_memory
dm_resource_governor_configuration
dm_resource_governor_resource_pools
dm_resource_governor_workload_groups
dm_server_audit_status
dm_sql_referenced_entities
dm_sql_referencing_entities
dm_tran_commit_table
dm_xe_map_values
dm_xe_object_columns
dm_xe_objects
dm_xe_packages
dm_xe_session_event_actions
dm_xe_session_events
dm_xe_session_object_columns
dm_xe_session_targets
dm_xe_sessions



The 13 DMVs listed below are new in CTP6



dm_audit_actions
dm_audit_class_type_map
dm_db_persisted_sku_features
dm_exec_procedure_stats
dm_exec_trigger_stats
dm_fts_fdhosts
dm_fts_index_keywords
dm_fts_index_keywords_by_document
dm_fts_outstanding_batches
dm_fts_parser
dm_os_dispatchers
dm_os_memory_node_access_stats
dm_server_audit_status



If you want to find out what the names of all the new DMVs are by running a query on your SQL Server 2008 box and you don't have a linked server to a SQL Server 2005 box then don't worry I have prepared the query below for you.


 
SELECT * FROM sysobjects
WHERE name LIKE 'dm_%'
AND name NOT IN('dm_os_hosts',
'dm_exec_cached_plan_dependent_objects',
'dm_os_memory_allocations',
'dm_os_loaded_modules',
'dm_db_task_space_usage',
'dm_os_memory_objects',
'dm_os_schedulers',
'dm_os_threads',
'dm_exec_requests',
'dm_db_missing_index_columns',
'dm_repl_tranhash',
'dm_qn_subscriptions',
'dm_db_session_space_usage',
'dm_exec_query_optimizer_info',
'dm_tran_top_version_generators',
'dm_os_waiting_tasks',
'dm_exec_background_job_queue',
'dm_exec_cursors',
'dm_db_missing_index_details',
'dm_clr_properties',
'dm_os_sublatches',
'dm_exec_query_memory_grants',
'dm_tran_current_snapshot',
'dm_io_virtual_file_stats',
'dm_exec_xml_handles',
'dm_os_wait_stats',
'dm_exec_text_query_plan',
'dm_broker_connections',
'dm_os_stacks',
'dm_os_ring_buffers',
'dm_db_missing_index_groups',
'dm_exec_cached_plans',
'dm_exec_sessions',
'dm_broker_forwarded_messages',
'dm_os_memory_clerks',
'dm_repl_articles',
'dm_fts_memory_buffers',
'dm_fts_index_population',
'dm_tran_current_transaction',
'dm_os_child_instances',
'dm_exec_connections',
'dm_exec_background_job_queue_stats',
'dm_fts_active_catalogs',
'dm_tran_database_transactions',
'dm_os_memory_cache_clock_hands',
'dm_repl_schemas',
'dm_db_mirroring_connections',
'dm_db_index_operational_stats',
'dm_db_partition_stats',
'dm_io_pending_io_requests',
'dm_os_memory_cache_entries',
'dm_os_virtual_address_dump',
'dm_tran_transactions_snapshot',
'dm_exec_query_plan',
'dm_os_memory_cache_hash_tables',
'dm_exec_query_stats',
'dm_clr_tasks',
'dm_os_worker_local_storage',
'dm_db_index_usage_stats',
'dm_db_index_physical_stats',
'dm_os_buffer_descriptors',
'dm_tran_active_snapshot_database_transactions',
'dm_tran_active_transactions',
'dm_db_file_space_usage',
'dm_broker_activated_tasks',
'dm_broker_queue_monitors',
'dm_os_memory_cache_counters',
'dm_tran_session_transactions',
'dm_clr_appdomains',
'dm_exec_sql_text',
'dm_os_memory_pools',
'dm_os_latch_stats',
'dm_io_backup_tapes',
'dm_fts_memory_pools',
'dm_os_sys_info',
'dm_tran_locks',
'dm_exec_query_transformation_stats',
'dm_exec_query_resource_semaphores',
'dm_repl_traninfo',
'dm_db_missing_index_group_stats',
'dm_fts_population_ranges',
'dm_os_performance_counters',
'dm_os_workers',
'dm_io_cluster_shared_drives',
'dm_os_tasks',
'dm_exec_plan_attributes',
'dm_tran_version_store',
'dm_os_cluster_nodes',
'dm_clr_loaded_assemblies')

Enjoy exploring these DMVs



 



 


Wednesday, February 20, 2008

Microsoft SQL Server 2008 Feature Pack CTP, February 2008

The Feature Pack is a collection of stand-alone install packages that provide additional value for SQL Server 2008. It includes the latest versions of:

Redistributable components for SQL Server 2008
Add-on providers for SQL Server 2008
Backward compatibility components for SQL Server 2008

Microsoft SQL Server 2008 Native Client
Microsoft SQL Server 2008 Native Client (SQL Native Client) is a single dynamic-link library (DLL) containing both the SQL OLE DB provider and SQL ODBC driver. It contains run-time support for applications using native-code APIs (ODBC, OLE DB and ADO) to connect to Microsoft SQL Server 2000, 2005, or 2008. SQL Native Client should be used to create new applications or enhance existing applications that need to take advantage of new SQL Server 2008 features. This redistributable installer for SQL Native Client installs the client components needed during run time to take advantage of new SQL Server 2008 features, and optionally installs the header files needed to develop an application that uses the SQL Native Client API.


Microsoft SQL Server 2005 Backward Compatibility Components
The SQL Server Backward Compatibility package includes the latest versions of Data Transformation Services 2000 runtime (DTS), SQL Distributed Management Objects (SQL-DMO), Decision Support Objects (DSO), and SQL Virtual Device Interface (SQLVDI). These versions have been updated for compatibility with both SQL Server 2005 and SQL Server 2008 and include all fixes shipped through SQL Server 2000 SP4 and SQL Server 2005 SP2.

Microsoft SQL Server 2008 Reporting Services Add-in for Microsoft SharePoint Technologies
Microsoft SQL Server 2008 Reporting Services Add-in for SharePoint Technologies allows you to take advantage of SQL Server 2008 report processing and management capabilities in SharePoint integrated mode. This version also includes data-driven subscriptions. The download provides a Report Viewer web part, web application pages, and support for using standard Windows SharePoint Services or Microsoft Office SharePoint Services.

Get it all here: http://www.microsoft.com/downloads/details.aspx?FamilyId=D68DE3C9-60A9-49C9-A28C-5C46BBC3356F&displaylang=en

SQL Server 2008 February CTP is now available for public download

SQL Server 2008 February CTP is finally here, this CTP is supposed to be feature complete.

Download the February CTP from the Download Center!

What's New in SQL Server 2008 February CTP?

Enter to win an Xbox in the SQL Server 2008 February CTP Bug Bash!

Monday, February 18, 2008

If Airplanes Were Made By Using Scrum/Agile

So I have been doing Scrum for a while now, I came across this video and thought it was hilarious. When you do Scrum you develop by using sprints, a sprint is usually between 2 and 4 weeks and at the end of the sprint you should have something working that you can show to the client/business unit

Watch the video



If someone is interested in a high level post about Scrum then leave a comment and I will post something next week

Sunday, February 17, 2008

Weekly Links 20080217

I decided to do a weekly links post with interesting SQL Server stuff, I also include a bunch of funny things at the bottom.

Technical Stuff:
Bob Beauchemin has two post that deal with Spatial Data: Using SQL Server 2008 spatial and the Virtual Earth map control - 1 and Using SQL Server 2008 spatial and the Virtual Earth map control - 2. The Spatial Data posts are more for people who do front end as well as back end development.
Two Interesting articles by the PSS SQL Server Engineers
How it Works: SQL Server Per Query Degree Of Parallelism Worker Count(s) and How It Works: SQL Server 2005 Connection and Task Assignments
Kalen Delany's Geek City: String Statistics post. My own Functions That Are Not Often Used: SIGN from sqlblog. Amdahl’s Law by Linchi Shea

If that is not enough for you there are also a bunch of SQL Server 2008 Webcasts available as well as a bunch of SQL Server 2008 Videos.

The non technical stuff:
Like Father Like Grandson
I had friends...
Pronounce this if you can
Peek into offices at LinkedIn, Flickr & Facebook

HTTP Endpoints deprecated In SQL Server 2008, Just Like Notification Services

Just like Notification Services HTTP Endpoints have been deprecated in SQL Server 2008. Bob Beauchemin's Blog has more info here: HTTP Endpoints to be deprecated in SQL Server 2008

Thursday, February 14, 2008

SQL Server 2008 Whitepapers

General
SQL Server 2008 Product Overview
Microsoft® SQL Server™ provides a policy-based system for managing one or more instances of SQL Server along with tools for performance monitoring, troubleshooting, and tuning that enable administrators to more efficiently manage their databases and SQL Server instances.
Focus: What's New
Audience: High-level

Business Intelligence
An Introduction to New Data Warehouse Scalability Features in SQL Server 2008
With the 2008 release, SQL Server makes a major advance in scalability for data warehousing. It meets the data warehouse needs of the largest enterprises more easily than ever. SQL Server 2008 provides a range of integrated products that enable you to build your data warehouse, and query and analyze its data. These include the SQL Server relational database system, Analysis Services, Integration Services, and Reporting Services. This paper introduces the new performance and manageability features for data warehousing across all these components. All these features contribute to improved scalability.
Audience: High-level

SQL Server 2008 Analysis Services Overview
Microsoft SQL Server 2008 Analysis Services builds on the value delivered with the significant investments in Analysis Services 2005 around scalability, advanced analytics and Microsoft Office interoperability. This paper covers a high-level look at the key Analysis Services features available in SQL Server 2008.
Audience: High-level

Predictive Analysis with SQL Server 2008
This 10-page paper explores the complete and intuitive set of data mining tools offered in Microsoft SQL Server 2008: Predictive Analysis for All Users, Insight at Every Step of the Data Lifecycle, and Data Mining Awareness in Every Application.
Audience: High-level

Business Intelligence in SQL Server 2008
This 10-page paper includes: Introduction, Unifying Data Storage and Access, Building and Managing Sophisticated BI Solutions, Extending the Reach of Your BI Solution, and Conclusion.Focus: Business Intelligence
Audience: High-level

SQL Server 2008 Reporting Services Whitepaper
This paper discusses how Microsoft SQL Server 2008 Reporting Services provides a complete server-based platform that is designed to support a wide variety of reporting needs including managed enterprise reporting, ad-hoc reporting, embedded reporting, and web based reporting to enable organizations to deliver relevant information where needed across the entire enterprise.Focus: Reporting Services
Audience: High-level

An Introduction to SQL Server 2008 Integration ServicesThis paper discusses the challenges that face businesses that rely on data integration technologies to provide meaningful, reliable information to maintain a competitive advantage in today’s business world. It discusses how SQL Server 2008 Integration Services (SSIS) can help Information Technology departments meet data integration requirements in their companies. Real-world scenarios are included.Focus: Integration Services
Audience: High-level Data Warehousing

Choosing SQL Server 2008 for Data Warehousing
This 10-page paper discusses: The State of Data Warehousing, The Realities of Data Warehousing Today, Putting the Technology Set Together, and Rounding It Out.Focus: Data Warehousing
Audience: High-level


Application Development/Data Programmability
Microsoft SQL Server 2008 and Microsoft Data Platform Development
This 10-page paper includes: Improved Productivity through ADO.NET Entity Framework, LINQ, and Visual Studio, Comprehensive Data Platform, and Scalable Data-Centric Solutions.
Focus: Developer Productivity
Audience: Technical

What's New for XML in SQL Server 2008?
A 16-page paper that discusses how Microsoft SQL Server 2008 builds on the extensive support for XML by extending support for XML schema validation and XQuery, and by enhancing the xml data type.
Focus: XML
Audience: Technical

Managing Unstructured Data with SQL Server 2008
This 11-page paper discusses how Microsoft SQL Server™ 2008 provides a flexible solution for storing unstructured data and combining it with relational data to build comprehensive solutions that encompass the full range of data across an organization.
Focus: Unstructured Data
Audience: Technical

SQL Server 2008: Delivering Location Intelligence with Spatial Data
This 10-page paper discusses how the new spatial support in Microsoft SQL Server™ 2008 can help you to make better decisions through visual analysis of location data that can be stored and manipulated in a SQL Server database.
Focus: Spatial Data
Audience: Mid-level

Online Transaction Processing/Data Management
SQL Server 2008 Security Overview for Database Administrators
SQL Server 2008 is secure by design, default, and deployment. Microsoft is committed to communicating information about threats, countermeasures, and security enhancements as necessary to keep your data as secure as possible. This paper covers some of the most important security features in SQL Server 2008. It tells you how, as an administrator, you can install SQL Server securely and keep it that way even as applications and users make use of the data stored within.
Focus: Security
Audience: Mid-level

Online Transaction Processing in SQL Server 2008
This 10-page paper includes: Introduction, Scale and Performance, High Availability, Security, and Manageability.
Focus: OLTP
Audience: High-level

SQL Server 2008 Manageability
This paper discusses how Microsoft SQL Server 2008 builds on the management capabilities of previous versions and provides a variety of tools and frameworks to help you manage your enterprise data environment.
Focus: Manageability
Audience: High-level

SQL Server 2008 Performance and Scale
This paper discusses how Microsoft SQL Server 2008 incorporates the tools and technologies that are necessary to implement relational databases, reporting systems, and data warehouses of enterprise scale, and provides optimal performance and responsiveness.
Focus: Scale and Performance
Audience: Mid-level

Server Consolidation
Server Consolidation with SQL Server 2008
This 10-page paper includes: Introduction, Flexibility, Manageability, Scalability and Performance, and Conclusion.
Focus: Server Consolidation
Audience: High-level

Thursday, February 07, 2008

SQL Server 2008: When Was The Server Last Started?

SQL Server 2008 has an additional column in the sys.dm_os_sys_info Dynamic Management View. The name of the column is sqlserver_start_time and it will be the time SQL Server was last restarted

SELECT sqlserver_start_time FROM sys.dm_os_sys_info

Review of Inside Microsoft SQL Server 2005 Query Tuning and Optimization

SQL performance tuning is probably one of those things you can do to really make a HUGE difference in performance. Let’s put this in perspective: take a typical application, if you can improve the performance by 100% then you really made a huge improvement. You can improve a SQL query by 1000% with 2 lines of code (sometimes all you have to do is take away a % sign). If you can make a query sargable so that the optimizer can do an index seek instead of an index scan your query might go from 12 seconds to 200 milliseconds. Now try doing that in an application, even if you change all the string concatenation to use a stringbuilder instead of creating new strings all the time you will not get such a drastic performance improvement. I am sure you get the point by now, let’s talk about the book.

Inside Microsoft SQL Server 2005: Query Tuning and Optimization is part 4 of the Inside Microsoft SQL Server 2005 series, it is written by Kalen Delaney and five other authors. There are 6 chapters in this book

1 A Performance Troubleshooting Methodology

This chapter explains some typical things that affect performance and also gives a troubleshooting overview


2 Tracing and Profiling

This chapter explains how to use the profiler and how to analyze traces. SQL Server’s built-in traces are also covered


3 Query Execution

This chapter gives a query processing and execution overview. It explains how to read plans and goes into a lot of detail about analyzing plans


4 Troubleshooting Query Performance

This chapter explains how to detect problems in plans, how to improve queries and some best practices


5 Plan Caching and Recompilation

This chapter goes into detail about plan caching and recompilation and how to troubleshoot plan cache issues


6 Concurrency Problems

The final chapter deals with concurrency (locking, blocking and deadlocking)



This is an excellent book for an intermediate/advanced developer. There is so much new stuff in SQL Server 2005 compared to 2000 to help you with tuning queries that you probably want to read each chapter several times. The Dynamic Management Views are a big help and this book shows you how to use them. Some other cool stuff in this book is the discussion of internal tables, undocumented DBCC commands and undocumented trace flags to discover information which could help you determine much faster what the cause of a performance problem might be.
Some pages are packed with so much information that you need to pause for a second and process all that info (I have read some pages two to three times in a row). You will also find out that there are more joins besides left, full and outer. Page 137 for example has a nice table with the three Physical Join Operators: Nested Loop Join, Hash Join and Merge Join. This table lists the characteristics for each of these joins.

If you are an intermediate to advanced developer then I highly recommend this book. I have interviewed Kalen a while back about this book and you can find that interview here
http://sqlservercode.blogspot.com/2007/10/interview-with-kalen-delaney-about.html

Wednesday, February 06, 2008

33 New Dynamic Management Views In SQL Server 2008

I was just poking around in SQL Server 2008 and wanted to know if there were any new Dynamic Management Views. There are a total of 33 new Dynamic Management Views. The list of them is below, I think their names make clear what the dmv is supposed to do (or at least I think I know)


dm_cdc_errors
dm_cdc_log_scan_sessions
dm_cryptographic_provider_algorithms
dm_cryptographic_provider_keys
dm_cryptographic_provider_properties
dm_cryptographic_provider_sessions
dm_database_encryption_keys
dm_db_mirroring_auto_page_repair
dm_db_mirroring_past_actions
dm_filestream_oob_handles
dm_filestream_oob_requests
dm_os_dispatcher_pools
dm_os_memory_brokers
dm_os_memory_nodes
dm_os_nodes
dm_os_process_memory
dm_os_spinlock_stats
dm_os_sys_memory
dm_resource_governor_configuration
dm_resource_governor_resource_pools
dm_resource_governor_workload_groups
dm_sql_referenced_entities
dm_sql_referencing_entities
dm_tran_commit_table
dm_xe_map_values
dm_xe_object_columns
dm_xe_objects
dm_xe_packages
dm_xe_session_event_actions
dm_xe_session_events
dm_xe_session_object_columns
dm_xe_session_targets
dm_xe_sessions



If you want to find out what the names of all the new DMVs are by running a query on your SQL Server 2008 box and you don't have a linked server to a SQL Server 2005 box then don't worry I have prepared the query below for you.



SELECT * FROM sysobjects
WHERE name LIKE 'dm_%'
AND name NOT IN('dm_os_hosts',
'dm_exec_cached_plan_dependent_objects',
'dm_os_memory_allocations',
'dm_os_loaded_modules',
'dm_db_task_space_usage',
'dm_os_memory_objects',
'dm_os_schedulers',
'dm_os_threads',
'dm_exec_requests',
'dm_db_missing_index_columns',
'dm_repl_tranhash',
'dm_qn_subscriptions',
'dm_db_session_space_usage',
'dm_exec_query_optimizer_info',
'dm_tran_top_version_generators',
'dm_os_waiting_tasks',
'dm_exec_background_job_queue',
'dm_exec_cursors',
'dm_db_missing_index_details',
'dm_clr_properties',
'dm_os_sublatches',
'dm_exec_query_memory_grants',
'dm_tran_current_snapshot',
'dm_io_virtual_file_stats',
'dm_exec_xml_handles',
'dm_os_wait_stats',
'dm_exec_text_query_plan',
'dm_broker_connections',
'dm_os_stacks',
'dm_os_ring_buffers',
'dm_db_missing_index_groups',
'dm_exec_cached_plans',
'dm_exec_sessions',
'dm_broker_forwarded_messages',
'dm_os_memory_clerks',
'dm_repl_articles',
'dm_fts_memory_buffers',
'dm_fts_index_population',
'dm_tran_current_transaction',
'dm_os_child_instances',
'dm_exec_connections',
'dm_exec_background_job_queue_stats',
'dm_fts_active_catalogs',
'dm_tran_database_transactions',
'dm_os_memory_cache_clock_hands',
'dm_repl_schemas',
'dm_db_mirroring_connections',
'dm_db_index_operational_stats',
'dm_db_partition_stats',
'dm_io_pending_io_requests',
'dm_os_memory_cache_entries',
'dm_os_virtual_address_dump',
'dm_tran_transactions_snapshot',
'dm_exec_query_plan',
'dm_os_memory_cache_hash_tables',
'dm_exec_query_stats',
'dm_clr_tasks',
'dm_os_worker_local_storage',
'dm_db_index_usage_stats',
'dm_db_index_physical_stats',
'dm_os_buffer_descriptors',
'dm_tran_active_snapshot_database_transactions',
'dm_tran_active_transactions',
'dm_db_file_space_usage',
'dm_broker_activated_tasks',
'dm_broker_queue_monitors',
'dm_os_memory_cache_counters',
'dm_tran_session_transactions',
'dm_clr_appdomains',
'dm_exec_sql_text',
'dm_os_memory_pools',
'dm_os_latch_stats',
'dm_io_backup_tapes',
'dm_fts_memory_pools',
'dm_os_sys_info',
'dm_tran_locks',
'dm_exec_query_transformation_stats',
'dm_exec_query_resource_semaphores',
'dm_repl_traninfo',
'dm_db_missing_index_group_stats',
'dm_fts_population_ranges',
'dm_os_performance_counters',
'dm_os_workers',
'dm_io_cluster_shared_drives',
'dm_os_tasks',
'dm_exec_plan_attributes',
'dm_tran_version_store',
'dm_os_cluster_nodes',
'dm_clr_loaded_assemblies')

Enjoy exploring these DMVs


Monday, February 04, 2008

Windows Server 2008 and Vista SP1 releasing to manufacturers today

Windows Server 2008 RTM: http://www.microsoft.com/presspass/features/2008/feb08/02-04WS2008.mspx

Windows Vista SP1: http://windowsvistablog.com/blogs/windowsvista/archive/2008/02/04/announcing-the-rtm-of-windows-vista-sp1.aspx

Should You Get Your Database Under Version Control?

CodingHorror has a blogpost titled Get Your Database Under Version Control


It is suggested that you also keep the data in version control. I am reading through the comments and I am amazed. One person writes "Once you have used ActiveRecord Migrations it is very hard to go back!"


This might work for a small or medium size database. My database is well over a terabyte, how would you keep that data under version control? Data gets modified every day. Some of the data is encrypted. Some of the data gets inserted into audit tables. Data gets replicated to other servers/databases. There are jobs that pull in data from real time systems every second. I do have different versions of DBs on staging and QA servers but only one on the production server. Changes have to go through change management, you have to open a ticket to do a change. This is not something you would do on a daily basis.


What is your opinion? Do you have the schema in version control? What about the data itself?

Friday, February 01, 2008

Vote for SQL Server 2005 Service Pack 3

Hugo Kornelis makes a good point here: Want a Service Pack? Ask for it!
Service pack 2 for SQL Server 2005 is already 11 months old. And there is still no sign of service pack 3 on the horizon. Why is that? Has Microsoft managed to release a perfect, completely bug-free product? No, of course not – with the size and complexity of a product such as SQL Server is, that will simply never happen.

So do yourself (and me) a favor and vote here: http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=326575

Tuesday, January 29, 2008

Some Very Sad News For The SQL Server Community

Ken Henderson passed away this last Sunday. My condolences go out to his family, friends, and coworkers. I owe so much to Ken, if it wasn't for his books I would not be where I am today.

Ken, You will be missed.

Saturday, January 26, 2008

SQL Server 2008 To RTM In Q3 2008

Francois Ajenstat on his blog writes that

"Microsoft is excited to deliver a feature complete CTP during the Heroes Happen Here launch wave and a release candidate (RC) in Q2 calendar year 2008, with final Release to manufacturing (RTM) of SQL Server 2008 expected in Q3."


You can read the whole blog post here: http://blogs.technet.com/dataplatforminsider/archive/2008/01/25/microsoft-sql-server-2008-roadmap-clarification.aspx

Friday, January 25, 2008

Tip: Find all The Rows Where Any Of The Columns Is Null Or Zero Or Both

This question is asked every now and then so I decided to do a little blog post. How can you quickly without writing a bunch of OR statements determince if any columns have a NULL value, a value of 0 or if the value is 0 or NULL.
To test for NULL is very easy, you just concatenate the columns since NULL + anything else is always NULL. Okay that also depends on a setting.

Run this

SET
CONCAT_NULL_YIELDS_NULL ON
SELECT
NULL + '1' --NULL

SET CONCAT_NULL_YIELDS_NULL OFF
SELECT
NULL + '1' --1

As you can see if CONCAT_NULL_YIELDS_NULL is OFF then the result is 1

Now take a look at this


SET CONCAT_NULL_YIELDS_NULL ON
SELECT
NULL + 1 --NULL



SET CONCAT_NULL_YIELDS_NULL OFF
SELECT
NULL + 1 --NULL


So with numeric values it behaves differently. Either way by default CONCAT_NULL_YIELDS_NULL is set to on
To test for NULLS or zeroes you use NULLIF
To test for zeros you can combine COALESCE and NULLIF

Here is the code which shows all of that

CREATE
TABLE #test(column1 int,column2 varchar(4),column3 float)

INSERT
#test VALUES(2,'2',2)
INSERT #test VALUES(0,'1',0)
INSERT #test VALUES(null,'1',0)
INSERT #test VALUES(1,null,0)
INSERT #test VALUES(0,'1',null)
INSERT #test VALUES(null,null,null)



--Any column is Null
SELECT * FROM #test
WHERE column1 + column2+column3 is null

Output
------------
NULL 1 0.0
1 NULL 0.0
0 1 NULL
NULL NULL NULL



--Any column is Null or zero
SELECT * FROM #test
WHERE NULLIF(column1,0) + NULLIF(column2,0)+NULLIF(column3,0) is null

Output
-------------------
0 1 0.0
NULL 1 0.0
1 NULL 0.0
0 1 NULL
NULL NULL NULL




--Any column is zero
SELECT * FROM #test
WHERE NULLIF(COALESCE(column1,1),0) +
NULLIF(COALESCE(column2,1),0)+
NULLIF(COALESCE(column3,1),0) is null

Output
-------------------
0 1 0.0
NULL 1 0.0
1 NULL 0.0
0 1 NULL


DROP TABLE #test

Some Links To Blogs By Some Friends Of Mine

Since I have nothing useful to post today I decided to post some links to some of my friends

The first one is from someone in Belgium, his name is Christiaan Baes and he seems to like ORM tools like NHibernate. His blog is mostly about .NET. I'll forgive the fact that he is born 100 miles south by mistake.

The second one is from Mark Smith and he blogs about ASP.NET, SQL Server, HTML, CSS and other random thoughts. Mark's other site is http://aspnetlibrary.com/

The third one is from Denny Cherry, Denny has worked with shops running hundreds of SQL Servers with over half a billion transactions per second through out the farm.

The fourth one is from Alex Cuse and I don't think Alex himself knows what he is blogging about :-)

Sunday, January 13, 2008

The last two days have been the worst of my life

The last two days have been the worst of my life; it feels like he combination of a really bad hangover, the flu and a massive toothache. It all started on Wednesday afternoon; my tooth and the gum fell a little sore. Instead of going to the dentist like a normal person I decided to wait because it will go away. Thursday it fell worse and I had to ask for Motrin at work. I did not sleep at all Thursday night, I called my dentist at 6AM but he couldn’t see me until 12:20 PM. I figured he’ll give me a shot, clean out the tooth and I’ll be back at work at 2PM.
Well it turns out a root canal I had done 10 years ago acted up and they have to do a root end resection. My dentist doesn’t do root canals; he referred me to a specialist. The specialist is fully booked and doesn’t have an opening till Tuesday morning.
My dentist prescribed Oxycodone W/APAP (also known as Oxycontin or Roxicodone) and Amoxicillin. That stuff is pretty intense, your pain goes away but you are pretty much useless. The pain is gone but now my right cheek is swollen and I have to throw up every hour or so. I just hope all this ends by Tuesday, the fix the root canal and I can be at my desk by 12PM.
The reason I wrote this is that next time I say “I have no time to floss for five5 minutes I’ll do one minute instead” I can look back at this post and hopefully change my mind

Thursday, January 10, 2008

Yet Another Date Teaser

It has been a while since my last teaser but here we go

What do you think the following returns?


SELECT CONVERT(datetime,'1/1/1') -CONVERT(datetime,1) + CONVERT(datetime,0)



How about this on SQL Server 2008


SELECT CONVERT(datetime2,'1/1/1'),CONVERT(datetime2,'01/01/01'),CONVERT(datetime2,'0001/01/01')


Now run this on SQL Server 2008

SELECT
ISDATE('1/1/1'),
ISDATE('01/01/01'),
ISDATE('001/01/01'),
ISDATE('0001/01/01')


Now just for fun run these 4 on SQL Server 2008, one of them will fail so run them one by one

SELECT CONVERT(datetime2,'1/1/1')
SELECT CONVERT(datetime2,'01/01/01')
SELECT CONVERT(datetime2,'001/01/01')
SELECT CONVERT(datetime2,'0001/01/01')

Compare the isdate output to the select statement, see the inconsistency?

Monday, January 07, 2008

Has Anyone Succeeded In Creating A Collision Between NEWID and NEWSEQUENTIALID

SQL Server 2005 introduced a new type of function to create a uniqueidentifier; the NEWSEQUENTIALID(). This new function has been created for performance reasons, each new value is greater than the previous value. In theory this means that the value will be inserted at the end of a page and not in the middle which can cause splits.

Let's run this code to see the difference

CREATE TABLE #TableSeqID (ColumnA uniqueidentifier DEFAULT NEWSEQUENTIALID(),
ColumnB uniqueidentifier DEFAULT NEWID())

INSERT #TableSeqID DEFAULT VALUES
INSERT #TableSeqID DEFAULT VALUES
INSERT #TableSeqID DEFAULT VALUES
INSERT #TableSeqID DEFAULT VALUES
INSERT #TableSeqID DEFAULT VALUES
GO


SELECT * FROM #TableSeqID

Output
-----------
BBF765FE-57BD-DC11-875F-000D5684F8D8 CE51B9E4-1640-47E2-87C6-6ADD46C63A87
BCF765FE-57BD-DC11-875F-000D5684F8D8 CA220BAB-462E-440E-829A-E0037CAF0D1F
BDF765FE-57BD-DC11-875F-000D5684F8D8 01748772-8155-4F83-A58F-CC3253DDD3F3
BEF765FE-57BD-DC11-875F-000D5684F8D8 9C4B2C87-AE33-4432-8310-3BE731179382
BFF765FE-57BD-DC11-875F-000D5684F8D8 1F84B827-F42A-4C47-8A1B-4B672B4402F1


As you can see ColumnB is random (Or at least pseudo-random) while ColumnA is not
Let's say you have a table with a billion rows, this table used NEWID() up till now. What will happen when you change the table to use NEWSEQUENTIALID(), could you get a duplicate?
I tried my best and filled up my 400GB External Seagate drive without success

Have you run into a collision, is it even possible?

Sunday, January 06, 2008

I won't be flying on this sucker

FAA: Boeing's New 787 May Be Vulnerable to Hacker Attack
Boeing's new 787 Dreamliner passenger jet may have a serious security vulnerability in its onboard computer networks that could allow passengers to access the plane's control systems, according to the U.S. Federal Aviation Administration.

The computer network in the Dreamliner's passenger compartment, designed to give passengers in-flight internet access, is connected to the plane's control, navigation and communication systems, an FAA report reveals.


http://www.wired.com/politics/security/news/2008/01/dreamliner_security

Saturday, January 05, 2008

The World Is Small, The Risk Of Your Data Being Stolen Is Not!

Remember the How Is Your Sensitive Data Encrypted In The Database? post I wrote a while back? A colleague just informed me that he got a letter from that same datacenter. The letter states that his personal data was on one of those servers which got stolen. I told him that this is the reason we encrypt our data and also why we encrypt outside of the DB. The world is small indeed.

Here is a pic of the letter

IdentityTheft

Wednesday, January 02, 2008

Use the *1 trick to do math with two varchars, this prevents the Invalid operator for data type. Operator equals subtract,type equals varchar message

Someone had code like this on the tek-tips forum

DECLARE @v varchar(24)
SELECT @v ='06029202400250029'

SELECT RIGHT(@v,4) -SUBSTRING(@v,10,4)

If you run this code, you will get the following message
Server: Msg 403, Level 16, State 1, Line 4
Invalid operator for data type. Operator equals subtract, type equals varchar.

Instead of casting to integers you can also use this little trick. You basically multiply one of the values by 1

DECLARE @v varchar(24)
SELECT @v ='06029202400250029'

SELECT RIGHT(@v,4) *1 -SUBSTRING(@v,10,4)



Another example. This doesn't work
SELECT '2' - '1'

This does work
SELECT '2' * 1 - '1'

Top Ten Posts Of 2007

Here is the list of the ten most popular posts for 2007 in terms of pageviews according to Google Analytics

1 The Sysinternals Troubleshooting Utilities have been rolled up into a single Suite of tools
2 Ten SQL Server Functions That You Hardly Use But Should
3 Become a better developer in 6 months
4 You Should Never Use IN In SQL To JOIN With Another Table
5 The Sad State Of Programmers Part 1 : The Phone Interview.
6 This has to be one of the worst planned projects in recent Database history
7 Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. SQL 2005
8 How Well Do You Interview And Do You Use Wizard Driven Programming?
9 Make Your Case Sensitive Searches 1000 Times Faster
10 The Sad State Of Programmers Part 2 : The In Person Interview

Top Ten Posts Of All Time

Here is the list of the ten most popular posts in terms of pageviews since I started collecting this info with google Analytics. I haven't updated this list since April or May

1 The Sysinternals Troubleshooting Utilities have been rolled up into a single Suite of tools
2 Ten SQL Server Functions That You Hardly Use But Should
3 Become a better developer in 6 months
4 SQL Query Optimizations
5 Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. SQL 2005
6 You Should Never Use IN In SQL To JOIN With Another Table
7 The Sad State Of Programmers Part 1 : The Phone Interview.
8 Five Ways To Return Values From Stored Procedures
9 This has to be one of the worst planned projects in recent Database history
10 How Well Do You Interview And Do You Use Wizard Driven Programming?

Updated 2008-01-02

Friday, December 28, 2007

The Best Geek Story Ever Told

Go to DotNetRocks, download show number 300, fast forward to 57:45 and start listening. It is the funniest geek story I have ever heard. You will not regret it



Here is the link to the show: http://www.dotnetrocks.com/default.aspx?showNum=300


BTW the whole podcast is very interesting in terms of computer history, I highly recommend listening to it.

Thursday, December 27, 2007

A year in review, The 21 + 1 best blog posts on SQLBlog

These are the best posts according to me, it might have been the content or it might have been the comments. Either way here are the 21 + 1 posts I enjoyed the most. But wait the year is not over yet. Doesn't matter no one will write anything good till next year anyway (prove me wrong and I WILL update this post).

The first post is really from last year, I mean really, who writes a post on '2006-12-31T13:49:00.000' (yes that is ISO8601)? Since I did not see the post until 2007 I have included it in the list. I tried not to include more than 2 or 3 posts per blogger, I would have included all Hugo's NULL posts otherwise. What is with the 21 + 1 title? The +1 one is my post about using bitwise logic, it is the last link

Below is the list, let me know if I missed anything you really enjoyed and Happy New Year



The Beatles versus the Stones
How Many Data Files Should I Create for a User Database?
[Editorial] Get rid of the bad apples in IT?
NULL - The database's black hole
Performance Impact of Procedure Calls without Owner Qualification -- SQL Server 2000
Performance Impact of Procedure Calls without Owner Qualification
Did You Know? Run a batch multiple times
Want to Control the Procedure Cache?
Is statistics over non-indexed columns updated by index rebuild?
Xp_cmdshell and permissions
The Perils of Hyperthreading for SQL Server
5 Things every DBA should know like the back of their hand...
Filegroups Part I - Dividing Data for Performance
Did You Know? SP2 does NOT limit the amount of plan cache you can have
Sorted views...
2008: Initializing Table Data with Row Constructors
2008: Row Constructor or Table-Valued Parameter
Anti-Patterns and Malpractices, Volume 1: Tumbling Data
10 lessons from 35K tps
What’s wrong with SELECT * ?
Backup compression in SQL Server 2008


This one is mine


Speed Up Performance And Slash Your Table Size By 90% By Using Bitwise Logic

Red Gate SQL Data Generator 1.0 Beta Available For Download

Red Gate have released Red Gate SQL Data Generator 1.0 Beta

From the site:

This tool is aimed at generating test data for SQL Server databases. It can either generate data from scratch or import from existing sources of data.(Like SQL tables or CSV files.)
Features:
- Full SQL Server 2000 and 2005 support
- All data types supported except CLR types
- Pre & Post Scripts execution
- Command-line access version
- Import data from CSV or SQL tables
- Customizable generator settings that allow configuring the amount of nulls, unique values, minimum and maximum values, etc..
- Diverse range of inbuilt generators
The product is not yet complete, and we are looking for user feedback about what features and or functionality you would like in the final product.
*The beta version is set to work until 11 Apr 2008. "

This is a free open beta with the application due to expire on 11 April 2008 with a planned final released sometime before then.

What we really want now is for everyone to use the software and provide us with feedback for the final version. Please let us know on the forums what you like and don't like about the software and what we could do to solve all of your data generation problems!

Visit http://www.red-gate.com/MessageBoard/viewtopic.php?t=6140 for the announcement and download URL

Forums: http://www.red-gate.com/MessageBoard/viewforum.php?f=76

The Sad State Of Programmers Part 3: General Tips

This is the final part of this series. You can find the first two parts here

Part 1 The Phone Interview
Part 2 The face to face interview.


As far as the resume and interview tips go, I only focused on stuff I have encountered. You can find many tips on the internet and I did not want this post to be a copy of those.


Resume tips
Don’t repeat the same line

If you had 4 jobs and you did more or less the same thing then try to have a different description. If you have to read the same sentence 4 times it gets very boring fast. Try to emphasize what you did at one company versus another. Maybe you worked with a lot more data at one company, maybe your stored procedures had a lot more error checking or had complex business logic. If you list the same thing four times then you are not really differentiating yourself from other people to the prospective interviewer.

List variations of the same keyword
Some companies will feed your resume into a keyword matching program. So in addition to having SQL you also need T-SQL, Structured Query Language and Transact SQL. The first time a recruiter told me this I was baffled, “it is all the same” I told her, she then told me that they used programs and if you don’t score high enough they won’t even consider you.

Do not lie on your resume
If you don’t have experience in SQL Server 2005 then do NOT list it on your resume. It is better not to list it then to be asked about it and admitting you don’t know it. One person admitted he put Java on the resume because the recruiter told him so. Did this get him a job? Of course it did not. Once you have one thing that is not true on your resume the interviewer will wonder what else could be a lie.

Do not try to impress the interviewer on paper
If you have Impressive Object Oriented Skills listed on your resume then you can be sure the interviewer will ask all kinds of OOP stuff. If your skills are really not that impressive then it won’t look that good.

Don’t list your certification right below your name
I saw one resume where the person had the certification right below his name; a certification is not a Ph.D it doesn’t take a lot of money and years to get one. I did notice that the more certifications a person has the less the person knew. I don’t know why this is, maybe it is to compensate for lack of skills, and it is puzzling to me. Your certifications should be listed after your education.


Try to keep your resume concise
If you have a resume which spans 8 pages then try to make it into two or three pages if possible. You can accomplish this by using a smaller font, cutting out duplicate sentences and leaving out sentences that don’t really show any skills. A sentence like the following does not add anything to the resume at all: worked with third party development tools. What does that sentence tell someone? You can use an application or development tool, doesn’t everyone? If you are a web developer then do not list FrontPage on your resume, this will make you look like an amateur.

Use nice paper
Buy yourself some high-quality paper. Your resume is a summary of what you have accomplished so far, don’t use regular paper for that, be proud of your accomplishments use good paper! Keep your resume in pristine condition, buy a folder so that your resume doesn’t get wrinkled.

You worked at the same company for the past 15 years
List all the different positions you have held separately. Listing the positions separately will make the job progression within the company much more obvious.


Interviewing tips
Dress for success

I mentioned it before and I will mention it again: show up for the interview dressed in business attire.

Dress conservative
For women this means the following:
No miniskirts
No high heels or platform shoes
No revealing shirts
No excessive jewelry
No 80s hair styles
Don’t pour gallons of Chanel No 5 on yourself, some people are allergic to perfume and might cut the interview short.

Men should be equally conservative
A navy or black suit is your best bet. You should wear a white shirt; my wife who worked in the banking industry told me a story once about a perfect candidate who did not get hired because he wore a blue shirt. I know it sounds ridiculous but you never know who sits at the other end of the table. I do have friends who over the phone find out about the dress code and ask if they can come in without a suit. I wouldn’t do it; if you have a suit wear it.
No neon colored ties, pick a conservative color.
No excessive jewelry; a wedding band and a watch is all you need. Keep you Cartier love bracelet at home until you get hired.
Don’t be a walking perfume factory, this is not a date.
Shave and trim your hair, if you have long hair keep it out of your face, if you have a beard then keep it neat.

Do your research
Here are two true stories. One person asked if we made shampoos because she passed Johnson & Johnson on the way to our building, she assumed we were a subsidiary. Another person did not know we got acquired by News Corp. it is okay if you don’t know what we do and we did not ask you but do NOT ask what a company does, you should have looked that up before the interview. Do ask what direction the company is going to, how they plan to deal with competition etc.

Behave proper
What you consider normal might not be considered normal by other people. Some people have phobias; they don’t want to be touched for example. I asked a person to explain to me what a deadlock was, he told me to grab the phone then he grabbed my hand and told me to pick up the phone. He said I couldn’t pick up the phone because he locked it. Don’t chew gum. Don’t say “What?’ but ask the interviewer to repeat the question.

Ask questions
Don’t just answer question but also ask questions. Ask about the team, development style, growth of the department and anything else you deem important.

Technical skills and how to keep them up to date
Not everyone works with the latest versions of SQL Server or Visual Studio. Maybe you don’t have a MSDN subscription at work to download the latest versions. When asked if you used the latest version of SQL Server do not say “no because we don’t use it currently at my job”. Some companies will see this as a sign that you are doing the same stuff day in and day out. Download the latest CTP or free express versions, use it at home, build stuff on the weekends. This way you can say that even though you have not used it at work you were still exposed to it. You initiated this yourself and this is an indication that you are willing to learn even in your free time.
I always ask the candidate how the skills are kept up to date. A lot of people have a very tough time answering this question; it might be because they don’t keep it up to date unless they are sent to a training class by their current employer. Instead of paying $40 for a video game or the new HD DVD directors cut invest in a book, this $40 investment will pay itself back very fast (of course you need to read the book and not use it as a paper weight). When you are the one at work who people ask questions to then this will get noticed and you might get promoted sooner. If your employer does not reimburse you for books then keep the recites; if you itemize on your tax return you can use them to lower you marginal tax rate.
Get a RSS reader and subscribe to blogs. There is great content from the SQL Server team, from book authors and from trainers. SQLBlog is a great blog to subscribe to and also check out the roller (http://sqlblog.com/roller/roller.aspx) there are some great blogs there. Visit forums (fora) and newsgroups, here is the SQL server programming one
http://groups.google.com/group/microsoft.public.sqlserver.programming

If you are not comfortable answering question then lurk, read what the masters answer and you will remember it when you have the same problem later on. Don’t worry if you get flamed, I myself answered a question a long time ago and some MVP answered to my answer “Hello table scan anyone”. This brings you back to earth very fast and also makes you verify code for next time. It makes you a better programmer because who wants to get flamed or criticized every day? Not me.
If you have a thick skin then start a blog about programming. Post something bad and you will get comments; this also will make you a better programmer since you will be more careful later on. I remember when I started my blog and I had a post about DBCC PINTABLE, Hugo Kornelis posted a comment how that was being deprecated and should not be used. I could have easily deleted the post and the comment but I did not, this reminds me that I have to double check before I post if I don’t want to get some comments telling me that I am a n00b. Here is the link to that post
http://sqlservercode.blogspot.com/2005/09/put-tables-into-memory.html

This concludes this series, hopefully you learned something from it and look past the negativity to get something positive out of it(wow if that is not a self-help sentence then nothing is)

Happy New Year

Wednesday, December 26, 2007

Alien VS Predator picture

This is priceless

Alien VS Predator picture

In case you wonder which one the predator is, here is a hint
one of them preys on children :-)