SQLTeam.com | Weblogs | Forums

Some of the code missed after saving


#1

I am writing a code as sql view, after I save the view and reopen it I found that some of the code is missing, so the code doesn't work
Please see the screenshots below


What might be the issue here?


#2

The tab on the top screenshot has an '*' which means it wasn't saved


#3

You aren't running a CREATE VIEW but instead are running a query using a common table expression(WITH S...).
Please search for CREATE VIEW in BOL or google it.


#4

There have always been issues with the view designer in SSMS - as far back as SQL Server 2000 (maybe even earlier).

Don't use this to create your views - just open a new query window and build the statement. If you already have a defined view - you can right-click the view and script as ... to a new query window.