在运行表脚本中出现问题 [英] Getting issue in running table script

查看:193
本文介绍了在运行表脚本中出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

DROP DATABASE IF EXISTS MyDB; CREATE DATABASE MyDB; DROP TABLE IF EXISTS MyDB.dbo.Customers; CREATE TABLE MyDB.dbo.Customers ( Customer string, Id int, INDEX idx CLUSTERED(Customer ASC) DISTRIBUTED BY HASH(Customer) ); @customers = SELECT * FROM (VALUES ("Contoso", 123 ), ("Woodgrove", 456 ) ) AS D( Customer, Id ); INSERT INTO MyDB.dbo.Customers SELECT * FROM @customers; @rs = SELECT * FROM MyDB.dbo.Customers; OUTPUT @rs TO "/tableOUTPUT.tsv"

Am在Visual Studio中的数据湖扩展中运行,无论何时运行出现此错误

Am running in data lake extension in visual studio and whenever i run i get this error

严重性代码说明项目文件行抑制状态错误E_CSC_USER_READAFTERDML:尝试从表MyDB.dbo.Customers中读取,该表先前已在同一脚本中进行了修改.说明:一旦在表T上的脚本中发生了DML,则以后任何语句都无法从T读取数据.解决方案:将DML分开并将访问权限读取到单独的脚本中. USQLApplication2 C:\ Users \ Dell \ source \ repos \ USQLApplication2 \ USQLApplication2 \ Script1.usql 28

Severity Code Description Project File Line Suppression State Error E_CSC_USER_READAFTERDML: Attempt to read from table MyDB.dbo.Customers which has been modified earlier in the same script. Description: Once a DML has occurred in a script on table T, no statement can later read data from T. Resolution: Separate the DML and read accesses into separate scripts. USQLApplication2 C:\Users\Dell\source\repos\USQLApplication2\USQLApplication2\Script1.usql 28

USING Outputters.Tsv();

推荐答案

显示错误消息时,请尝试将单个脚本的创建和读取分开,或尝试如下修改脚本

As the error message displays, please try to separate the creating and reading in single script or try modifying the script as below

DROP DATABASE IF EXISTS MyDB;
CREATE DATABASE MyDB;
DROP TABLE IF EXISTS MyDB.dbo.Customers;

CREATE TABLE MyDB.dbo.Customers
( 
    Customer string, 
    Id int, 
    INDEX idx  
        CLUSTERED(Customer ASC)
        DISTRIBUTED BY HASH(Customer) 
);

@customers  = 
  SELECT * FROM 
    (VALUES
       ("Contoso",   123 ),
       ("Woodgrove", 456 )
    ) AS D( Customer, Id  );



INSERT INTO MyDB.dbo.Customers
    SELECT * FROM @customers;

@rs =
    SELECT *
    FROM @customers;

OUTPUT @rs
TO "/tableOUTPUT.tsv"
USING Outputters.Tsv();

它工作正常.请查看以下屏幕截图:

it works fine. check out below screenshots:

tableOUTPUT.tsv

工作状态:

输出:


这篇关于在运行表脚本中出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆