在 Azure Synapse 专用 SQL 池中,我有以下设置:
-- a custom DB role to manage privileges
CREATE ROLE [owner];
-- there is a schema owned by this role
CREATE SCHEMA [myschema] AUTHORIZATION [owner];
-- an Azure AD group to allow its members to log in
CREATE USER [radish] FROM EXTERNAL PROVIDER;
-- the AAD group is a member of the owner role
EXEC sp_addrolemember 'owner', 'radish';
-- privileges are assigned exclusively through custom DB roles
GRANT ALTER, CONTROL on SCHEMA::[myschema] TO [owner]; …
Run Code Online (Sandbox Code Playgroud) sql-server permissions active-directory azure-synapse-analytics dedicated-sql-pool
当我省略该ORDER BY
子句时,或者如果我将其作为选择运行并省略创建表部分,我有以下语句,但我需要这两者来确保生成的密钥排序正确
有任何想法吗?
消息 104381,级别 16,状态 1,第 18 行
ORDER BY 子句在视图、CREATE TABLE AS SELECT、INSERT SELECT、SELECT INTO、内联函数、派生表、子查询和公用表表达式中无效,除非 TOP 或 FOR XML 是还指定。
CREATE TABLE #demo
WITH (DISTRIBUTION = ROUND_ROBIN)
AS
SELECT
ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) AS ID,
schemas.name as [schema],
tables.name as [table],
columns.column_id as [ordinal],
columns.name as [column],
types.name as [type]
FROM SYS.COLUMNS
inner join sys.types
on types.system_type_id = columns.system_type_id
inner join sys.tables
on tables.object_id = columns.object_id
inner join sys.schemas
on schemas.schema_id = tables.schema_id
order by …
Run Code Online (Sandbox Code Playgroud)