Question

We have created a database project in VS2013. We added database structure. It works fine to publish and compare database.

Now on publish we want to automatically load several tables with default data which includes german letters for example;

insert into @ReportGruppe1 values(507,'ID_507','Flüssigkeitsbilanz (24 Stunden)','CC_1_LeerVordrucke_A4_Hoch.lst', 'AP;PP', 1,  10, 1)

What happens; ü and other German letters are replaced with some strange characters like "?" in black square while the post deployment script is running.

When I run the same script directly in SQL Server Management Studio everything works perfectly so it must be some problem with the project. Any ideas? How to handle this situation?

Was it helpful?

Solution

If you can insert those characters via mgmt console the columns should presumably be of type nvarchar.

To insert your data via script you need to mark your string input values als unicode by prefixing them with N:

N'Flüssigkeitsbilanz (24 Stunden)'

Your sample insert statement should look like this:

insert into @ReportGruppe1 values(507,'ID_507', N'Flüssigkeitsbilanz (24 Stunden)', N'CC_1_LeerVordrucke_A4_Hoch.lst', 'AP;PP', 1,  10, 1)

Check the data types of your columns and handle input for those accepting nvarchar (or nchar and other unicode types) accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top