将数据加载到PDW

时间:2018-05-18 19:09:09

标签: sql sql-server parallel-data-warehouse

 use tempdb;

CREATE TABLE #tmpMain(
     [PNRRecordLocator] char(6) COLLATE Latin1_General_100_CI_AS_KS_WS NULL, 
     [PNRCreateDate] date NULL)
 WITH (LOCATION = USER_DB)

 insert into #tmpMain 
 from {TKT].[TktCpn]
 where [CpnDepLocalDateTime] > '4/23/2018' and
     [CpnDepLocalDateTime] < '5/11/2018' and
     [CpnCurrentStatusCode] = 'USED' 

所以我第一次使用PDW服务器而且在将数据加载到临时表时遇到了一些麻烦。我相信我有正确的查询,但我仍然会在“from”附近用正确的语法说错误。

还需要指定(LOCATION = USER_DB)还是我输入的内容?抱歉PDW新手

2 个答案:

答案 0 :(得分:1)

你可以将花括号{更改为方括号之后更改[然后尝试插入/选择语句吗?

答案 1 :(得分:0)

你几乎拥有它。如果您事先创建表,则需要指定要插入的列

     insert into #tmpMain (PNRRecordLocator, PNRCreateDate)
     select PNRRecordLocator, PNRCreateDate
     from {TKT].[TktCpn]
     where [CpnDepLocalDateTime] > '4/23/2018' 
     and [CpnDepLocalDateTime] < '5/11/2018' 
     and [CpnCurrentStatusCode] = 'USED' 

如果你事先没有创建表,那么你可以做

     select PNRRecordLocator, PNRCreateDate
     into #tmpMain
     from {TKT].[TktCpn]
     where [CpnDepLocalDateTime] > '4/23/2018' 
     and [CpnDepLocalDateTime] < '5/11/2018' 
     and [CpnCurrentStatusCode] = 'USED'