SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 PDW string conca fail
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

waterduck
Aged Yak Warrior

Malaysia
965 Posts

Posted - 02/19/2014 :  03:26:39  Show Profile  Reply with Quote
not working query

CREATE TABLE a(Col1 varchar(20), Col2 int, Col3 int)WITH(CLUSTERED COLUMNSTORE INDEX )
INSERT INTO a SELECT 'Apple', 1, 2

DECLARE @SQL VARCHAR(8000)

SET @SQL = 'SELECT a.Col1, upvt.ColumnName, upvt.ColumnValue FROM a CROSS APPLY('
+ STUFF((SELECT ' UNION ALL SELECT ''' + CAST(COLUMN_NAME AS VARCHAR(125)) + ''' AS ColumnName, ' +
CAST(COLUMN_NAME AS VARCHAR(125)) + ' ColumnValue' FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'a' AND ORDINAL_POSITION <> 1 FOR XML PATH('')), 1, 11, '')
+ ')upvt'
EXEC (@SQL)



tried also
SELECT @SQL = @SQL + COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'a'

tried also
update #a set column_list = columnlist + COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'a'

any idea?

waterduck
Aged Yak Warrior

Malaysia
965 Posts

Posted - 02/19/2014 :  03:28:58  Show Profile  Reply with Quote
not sure this include at this post
select @@version

Microsoft SQL Server 2012 - 10.0.4429.0 (X64) Sep 13 2013 12:06:46 Copyright (c) Microsoft Corporation Parallel Data Warehouse (64-bit) on Windows NT 6.2 <X64> (Build 9200: )
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30282 Posts

Posted - 02/19/2014 :  09:29:31  Show Profile  Visit SwePeso's Homepage  Reply with Quote
There are a LOT of things not working in PDW.
The language of PDW is actually D-SQL, not T-SQL.

See http://download.microsoft.com/download/4/2/6/42616D71-3488-46E2-89F0-E516C10F6576/SQL_Server_to_SQL_Server_PDW_Migration_Guide.pdf




Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

waterduck
Aged Yak Warrior

Malaysia
965 Posts

Posted - 02/19/2014 :  19:45:27  Show Profile  Reply with Quote
yea, i notice that too....might as well using loop to get this work.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000