Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Bradley Schacht

Bradley is a consultant at Pragmatic Works in Jacksonville, FL. He was an author on the book SharePoint 2010 Business Intelligence 24-Hour Trainer and tech edited the SQL 2011 Bible. His experience on the Microsoft BI platform includes DTS, SSIS, SSRS, SSAS and migrations and conversions. He has helped numerous companies in successfully developing and implementing new business intelligence solutions into their organizations. Bradley also participates as a speaker in community events like SQL Saturday, Code Camp, SQL Lunch and SQL Server User Groups. He is a contributor on sites such as and SQL Server Central as well as an active member of the Jacksonville SQL Server User Group (JSSUG).

Converting SQL_VARIANT on PDW

There are a number of data types that are currently unsupported on PDW. Among those are SQL_VARIANT. The interesting part of that is that SQL_VARIANT along with several other unsupported data types are found all over the place in system tables in PDW. There is a simple solution, convert the value to something like VARCHAR. Well this wouldn’t be a blog post if that was all I had to say on the matter.

Turns out that you can select the data just fine, convert it in a select just fine, but for some odd reason not do an insert with it just fine. Let’s take the partitions range table for this example.

CONVERT(VARCHAR(200), value, 101) AS ConvertedText
FROM sys.partition_range_values

Try to insert that into a temp table and bad things happen.

--Create a temp table
CREATE TABLE #Partitions
Value VARCHAR(200)

--Load the temp table
INSERT INTO #Partitions
CONVERT(VARCHAR(200), value, 101) AS ConvertedText
FROM sys.partition_range_values

--Select the records
SELECT * FROM #Partitions

--Drop the table
DROP TABLE #Partitions

You will get this error when it runs the insert statement even though it is clearly being converted.


Msg 100077, Level 16, State 1, Line 1

Unsupported data type error. Statement references a data type that is unsupported in Parallel Data Warehouse, or there is an expression that yields an unsupported data type. Modify the statement and re-execute it.

The workaround: CTAS works like a charm!

CREATE TABLE TestPartition
CONVERT(VARCHAR(200), value, 101) AS ConvertedText
FROM sys.partition_range_values

SELECT * FROM TestPartition

DROP TABLE TestPartition

For those who require visual proof:


Happy CTASing and happy Friday!



Leave a comment on the original post [, opens in a new window]

Loading comments...