Database diagram support objects cannot be installed…

This is the second time I ran into this issue and think I should copy it here so that I don’t have to google it next time. The solution has been posted on

http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/9a9bf26c-bb14-4353-a4ec-ab53d68d6afc

Below is the script from that post


EXEC sp_dbcmptlevel 'yourDB', '90';
go
ALTER AUTHORIZATION ON DATABASE::yourDB TO "yourLogin"
go
use [yourDB]
go
EXECUTE AS USER = N'dbo' REVERT

go

When LTRIM() and RTRIM() do not work

When I analyzed the data from an Access database before import into our SQL database, I saw some strings with extra spaces at the end. So I thought I could simply use the RTRIM() function, I quickly put together a script and ran -> NOTHING WORKED

Tried couple times, the result still the same. It turns out there is a note in SQL Online Book

LTRIM does not remove white-space characters such as the tab or line feed characters…

And the spaces in the data are LFs (char(10)).  The solution is to replace those char(10) with a space (char(32)) before calling RTRIM()


UPDATE dbo.Cause_1
SET Result =  (RTRIM(REPLACE(Result, CHAR(10), CHAR(32))))

A more complete solution can be found at

http://blog.programmingsolution.net/sql-server-2008/removing-leading-and-trailing-white-space-characters-in-tsql/