小编Sco*_*ood的帖子

为什么我的ODBC连接在Visual Studio中运行SSIS加载时失败,而在使用Execute Package Utility运行相同的包时则失败

我正在SSIS 2012中处理数据集市加载包.当尝试在Visual Studio中执行包时,我收到此错误:

"AcquireConnection方法调用连接管理器Data Warehouse.ssusr失败,错误代码为0xC0014009".

当我测试Connection Manager Data Warehouse.ssusr的连接时,我看到它通过了.

当我使用Execute Package Utility在Visual Studio外部执行包时,包运行.

我不明白发生了什么.

该程序包还拒绝使用SQL Server作业计划运行,如果这与任何事情有关.

sql-server ssis etl

14
推荐指数
1
解决办法
4万
查看次数

如何在 SQL Server 中制作文件格式

我正在尝试在 SQL Server 2017 中使用外部文件,但在第一步中被难住了。

数据是用管道分隔的,我试图遵循文档中的语法,它需要一个FILE_FORMAT.

这是每个 Microsoft 的语法:

CREATE EXTERNAL TABLE [ database_name . [ schema_name ] . | schema_name. ] 
table_name   
( <column_definition> [ ,...n ] )  
WITH (   
    LOCATION = 'folder_or_filepath',  
    DATA_SOURCE = external_data_source_name,  
    FILE_FORMAT = external_file_format_name  
    [ , <reject_options> [ ,...n ] ]  
)  
[;]  
Run Code Online (Sandbox Code Playgroud)

那需要一个file_format。

这是每个 MS 页面的语法:

CREATE EXTERNAL FILE FORMAT file_format_name  
WITH (  
FORMAT_TYPE = DELIMITEDTEXT  
[ , FORMAT_OPTIONS ( <format_options> [ ,...n  ] ) ]  
[ , DATA_COMPRESSION = { …
Run Code Online (Sandbox Code Playgroud)

sql-server

8
推荐指数
1
解决办法
2577
查看次数

使用xpath从postgres中的XML列中提取数据

我做了下表:

create table temp.promotions_xml(id serial promotion_xml xml);
Run Code Online (Sandbox Code Playgroud)

我已将以下数据插入temp.promotions:

<promotions xmlns="http://www.demandware.com/xml/impex/promotion/2008-01-31">
    <campaign campaign-id="2013-1st-semester-jet-giveaways">
        <description>2013 1st Semester Jet Giveaways</description>
        <enabled-flag>true</enabled-flag>
        <start-date>2013-01-01T05:00:00.000Z</start-date>
        <end-date>2013-07-01T04:00:00.000Z</end-date>
        <customer-groups>
            <customer-group group-id="Everyone"/>
        </customer-groups>
    </campaign>
</promotions>
Run Code Online (Sandbox Code Playgroud)

数据在表中.

我无法弄清楚如何解决它.我可能希望能够填充我将构建的关系模型,所以我想摆脱所有标签.

以下是我尝试过的一些不起作用的查询.我很确定我只是围绕正确的语法跳舞.这些查询返回空集的行.

FWIW,我们正在使用Postgres 9.0.4.

谢谢, - 谢谢

select xpath('/promotions/campaign/description/text()',promotion_xml) textcol from temp.promotions_xml
select xpath('./promotions/campaign/description/text()',promotion_xml) textcol from temp.promotions_xml
select xpath('promotions/campaign/description/text()',promotion_xml) textcol from temp.promotions_xml
select xpath('///description/text()',promotion_xml) textcol from temp.promotions_xml
select xpath('//description/text()',promotion_xml) textcol from temp.promotions_xml
select xpath('.//description/text()',promotion_xml) textcol from temp.promotions_xml
select xpath('./campaign/description/text()',promotion_xml) textcol from temp.promotions_xml
select xpath('//campaign/description/text()',promotion_xml) textcol from temp.promotions_xml
Run Code Online (Sandbox Code Playgroud)

xml postgresql xpath xml-parsing

6
推荐指数
1
解决办法
3万
查看次数

如何查看公共数据集?

我正在尝试按照GitHub网站上的说明查看GitHub公共数据集.那里的说明是"添加项目名称githubarchive,但是在BigQuery网站上我看不到添加项目的方式.我确定我没有正确注册或者某些东西,但我不知道如何.

dataset google-bigquery

5
推荐指数
1
解决办法
1582
查看次数

是否有一种方便的方法来重置由分析函数创建的运行计数?

这是我要找的:

create table test.test(
col1 boolean,
act_date date)
Run Code Online (Sandbox Code Playgroud)

示例查询:

select 
    col1,
    act_date,
    row_number() over (partition by col1 order by act_date) rnum,
    rank() over (partition by col1 order by act_date) rrnum,
    dense_rank() over (partition by col1 order by act_date) drrnum
from test.test
order by act_date

col1   act_date   rnum   dnum   drnum   whatIwant
t      2018-08-12  1      1      1       1
f      2018-08-13  1      1      1       1
f      2018-08-14  2      2      2       2
t      2018-08-15  2      2      2       1
t      2018-08-16  3      3      3       2 …
Run Code Online (Sandbox Code Playgroud)

sql window-functions google-bigquery

3
推荐指数
1
解决办法
344
查看次数

在postgres中使用xpath提取多级xml数据

我需要从 postgres 中的 xml 列中提取三列数据,以便将 xml 扩展为适当的列。其中一列需要是 xml 的一个嵌套级别的属性,其他列是下一级嵌套的属性。应重复上级的数据。这可能吗?具体内容请参见下面的示例。

谢谢,--sw

考虑以下查询:

with x as (select
'<catalog catalog-id="manufacturer-catalog-id">
    <category-assignment category-id="category1" product-id="product1"/>
    <category-assignment category-id="category1" product-id="product2"/>
    <category-assignment category-id="category2" product-id="product3"/>
</catalog>'::xml as t
)
(
select 
    xpath('/catalog/@catalog-id', catalog_xml) catalog_id,  
    xpath('//@category-id', catalog_xml) category_assignment_category_id,
    xpath('//@product-id', catalog_xml) category_assignment_product_id
from (select unnest(xpath('/catalog', t)) catalog_xml from x) q
) 
Run Code Online (Sandbox Code Playgroud)

此查询返回以下数据:

"{manufacturer-catalog-id}";"{category1,category1,category2}";"{product1,product2,product3}"
Run Code Online (Sandbox Code Playgroud)

这个查询:

with x as (select
'<catalog catalog-id="manufacturer-catalog-id">
    <category-assignment category-id="category1" product-id="product1"/>
    <category-assignment category-id="category1" product-id="product2"/>
    <category-assignment category-id="category2" product-id="product3"/>
</catalog>'::xml as t
)
(
select
    xpath('/catalog/@catalog-id', catalog_xml) catalog_id,  
    xpath('//@category-id', catalog_xml) category_assignment_category_id, …
Run Code Online (Sandbox Code Playgroud)

xml postgresql xpath

2
推荐指数
1
解决办法
5322
查看次数