Replacing a specified nvarchar string in database column with a carriage return in sql-ce

StackOverflow https://stackoverflow.com/questions/21983810

  •  15-10-2022
  •  | 
  •  

Question

When not using the nvarchar and replacing with another string i.e.'test' I get the expected replacing results. I am attempting to insert a carriage return

private void reformatData(SqlCeConnection conn)
    {
        try
        {
            SqlCeCommand comm = new SqlCeCommand("UPDATE database " + "SET column = replace(MoodLog, '[ret]', nvarchar(13));", conn);
            comm.ExecuteNonQuery();
        }
        catch (SqlCeException ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }
Was it helpful?

Solution

Use the nchar function, no nvarchar function with SQL Server Compact:

http://technet.microsoft.com/en-us/library/ms174852.aspx

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