Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Schema differences for scalar-valued function

未關閉
#85 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
38/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
sql
領域
databases, tooling

研究方向

使用提供的 SSMS 函式定義、SqlPackage Extract 命令以及 Microsoft.SqlServer.DacFx 比較來重現此問題,使用的版本為 162.2.111。檢查純量值函式在擷取後如何被剖析和表示,然後確認 DeployReport 不再針對相同的 UETrim 函式回報 drop/create 作業,且擷取作業在沒有 TRIM 驗證錯誤的情況下完成。

由索引模型根據 Issue 內容生成。

描述

bug
  • SqlPackage or DacFx Version: 162.2.111
  • .NET Framework (Windows-only) or .NET Core: net8.0
  • Environment (local platform and source/target platforms): Win11&Server 2019

Steps to Reproduce:
-- SSMS>

USE MASTER;
GO

CREATE DATABASE dacFxRepro;
GO

USE dacFxRepro;
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[UETrim] (@text NVARCHAR(MAX)) RETURNS NVARCHAR(MAX) WITH SCHEMABINDING AS
BEGIN
RETURN (TRIM(NCHAR(0x09) + NCHAR(0x20) + NCHAR(0x0D) + NCHAR(0x0A) FROM @text))
END
GO

-- PS>
-- dotnet tool install --global microsoft.sqlpackage --ignore-failed-sources
-- $server = '.'
-- $database = 'dacFxRepro'
-- $connectionString = "server=$server;database=$database;Integrated Security=true;Connection Timeout=300;Trusted_Connection=True;Encrypt=False;Command Timeout=300"
-- $dacpacPath = '.\dacFxRepro.dacpac'
-- sqlpackage @('/Action:Extract', "/TargetFile:$dacpacPath", "/SourceConnectionString:$connectionString", "/p:IgnoreUserLoginMappings=true")

-- Output:
-- Connecting to database 'dacFxRepro' on server '.'.
-- Extracting schema
-- Extracting schema from database
-- *** Error validating element [dbo].[UETrim]: Incorrect syntax near TRIM.
-- Resolving references in schema model
-- Validating schema model for data package
-- Validating schema
-- Successfully extracted database and saved it to file '...\dacFxRepro.dacpac'.

When trying to compare the dacpac-file to a database using library Microsoft.SqlServer.DacFx, schema differences of function UETrim are reported, although the functions are identical in the database and in the dacpac file.

Same with sqlpackage:
-- PS>
-- $outputPath = 'report.xml'
-- sqlpackage @('/Action:DeployReport ', "/SourceFile:$dacpacPath", "/TargetConnectionString:$connectionString", "/OutputPath:$outputPath")

-- Output
--
--
--
--
--
-- <Item Value="[dbo].[UETrim]"
-- Type="SqlScalarFunction"/>
--
--
-- <Item Value="[dbo].[UETrim]"
-- Type="SqlScalarFunction"/>
--
--
--

Did this occur in prior versions? If not - which version(s) did it work in?
Yes.

(DacFx/SqlPackage/SSMS/Azure Data Studio)

主要語言
GAP
星號
278
分支
46
平均合併
9 天 23 小時
30 天內合併 PR
2

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/SqlScriptDOM 的其他 Issue

查看 microsoft/SqlScriptDOM 的全部 Issue

相似的 Issue

更多 Databases Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。