Skip to content

Increasing the length of a VARCHAR field leads to a data loss warning and a check that fails when rows are present. #724

@Irame

Description

@Irame
  • SqlPackage Version: 170.2.70.1
  • .NET Core: 10.0.100
  • Environment (local platform and source/target platforms):
    • Local Environment: Linux docker container (mcr.microsoft.com/dotnet/sdk:10.0)
    • Source: dacpac file
    • Target: MS SQL Server 15.0.2155.2

Steps to Reproduce:

  1. Create a SqlProject with dotnet new sqlproj -n VarCharSizeIncreaseTest
  2. Change the DSP Property to Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider to be able to target MS SQL Server 15.0.2155.2
  3. Add a TestTable.sql containing a varchar(20) field. (e.g. CREATE TABLE [dbo].[TestTable]([Text] [varchar](20) NULL);)
  4. Build and publish this project to a MS SQL Server.
  5. Change the field type from step 1 to [varchar](30).
  6. Deploy (or generate a Script) again against the same database as before to update it.
  7. This produces a warning for data loss and a check that fails if the Table contains any data. Even though the change does not lead to data loss in any way.

Did this occur in prior versions? If not - which version(s) did it work in?
This problem does not occur in version 170.0.48-preview or earlier.

Related Issues
I found this Issue #453 which described a similar issue but seemingly depending on the collation, which my problem does not. If I see this correctly, the Issue is already resolved and the fix should have been released in 170.0, but I am still experiencing the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions