SSMS 17 Database Diagram Table View Type Update not working - sql-server-2016

In SQL Server Management Studio 2017, while creating a new database diagram or updating the existing one, the default Table View type is Column Names.
But when I try to change the table view type, it gets changed to STANDARD irrespective of what table view type I have selected. Then if I try to change it back to Column Names, nothing happens. It remains stuck at STANDARD table view type.
I have tried repairing my SSMS and VS installations but nothing worked so far.
Any advice please ?

We are having the exact same problem with SSMS v17.1 (14.0.17119.0)
The only solution we have found is to remove the table from the diagram and re-add it.

While this issue is still existing, you can change the "Default table view" in
Tools > Option > Designers > Table and Database Designers
Then when you add new tables they will be the desired layout, without changing the ones previously added.

Related

Using data held in an SQL database in Visual Studio

So far, I have created 3 tables in SQL using visual studio. They have been connected to my VB project file and I can view the data held within them using the Database Explorer.
My only problem is: how do I use/make available the data held within each table?
I need to write code which will add a Japanese character (from one of the tables that already exists) to a new table when a check box is ticked. Then I need to write code to update the table and save the changes.
I have absolutely no idea how to retrieve the data held in each table nor how to write a SQL query in VB.
Any help would be appreciated.

Add new coloumn in design view failed

I have a DB table.This table has a data(Already data in that table).I wanted to add new coloumns to the database.I tried it in using Design View but CANT.Is there any way to do it.. Need to Change Coloumna name & SPECIALLY add new coloumns.. No data loss.
DB - SQL SERVER 2008 R2
I tried to add Name filed,thats NULL
When i go to SAVE it,i got this error
there is an option in Sql Management Studio that disables this safety mechanism, as the alert message says.
Tools --> Options --> Designers --> Table and Database Designers
uncheck "Prevent saving changes that require table re-creation".
You can of course always use ALTER TABLE ADD COLUMN

In SQL Server 2008 R2 - can you rename a table in the Database Diagram tool?

I'm using the SQL Server 2008 R2 version of the Database diagram tool. Search as I might, I can't seem to find a way to rename tables in the UI. Is this really not possible? Renaming a column is easy, but the only way I've been able to "rename" a tables is to recreate it with the new name, make the appropriate foreign key relationships, and then delete the old table.
thanks,
Sylvia
Nope you can't do that..however just click on the table in Object explorer, hit F2 and rename it
Yes, you can rename table in the Diagram tool. If you select the table, you can change the table's name in the Properties pane. If you do not see the Properties pane, simply press F4 and it should automatically appear on the right side of the Studio Manager.
The top section of Properties is (Identity) and Name is the first property. Simply change the value of the Name property and save.
It is possible to rename the table.
We can change the name of existed table by following code.
EXECUTE sp_rename 'oldTableName' , 'newTableName'
EXECUTE sp_rename 'tb1' , 'tb2'
It really work try it.

SQL Server 2008 : Cannot Insert new column in the middle position and change data type

My OS is Windows server 2008.
I've already installed SQL Server Express 2008.
I have several problems:
I can't insert a new column in the middle position. If I insert in the last one, I can save the table design.
I can change the column name but I can't change the data type.
I got error message :
Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be recreated or enabled the option Prevent saving changes that require the table to be re-created.
Example:
I have ID, Name, Phone, and Status columns. I am unable to add Address between Name and Phone.
But, I can add Address if i place it after Status.
Is there any way to solve this problem?
Thanks before.
In SSMS Tools -> Options -> Designers you would need to uncheck the option "Prevent Saving Changes that require table re-creation" to allow you to do this in SSMS.
This will rebuild the table and so generally isn't worth the hassle if the table is at all large and will make deployment to production trickier.
If there are columns which logically you would prefer to have next to each other to make writing queries easier you can create a View with the desired column order.
Column order doesn't matter either in the designer or in sys.columns.
The on disk storage will be the same regardless: Inside the Storage Engine - Anatomy of a record.
There is no performance benefit either.
I think using query it's not possible, but you do using UI of SSMS. right click on selected table and Insert Column whenever you want.
Think it does not matter columns order.
If you want a script to do this, all you need to do is select the data out into a temporary table, drop the table, recreate it with the columns in your preferred order and then reinsert the data from the temporary table in the right order.

How do I use SQL to Drop a Column from a MS ACCESS Database if that column is a replication ID?

I had a notion to use a database column of type replication ID, but have since changed my approach and want to use this column for another purpose.
However, I'm unable to use SQL to drop the column to remove it from my database.
My SQL is:
ALTER TABLE foo_bar DROP COLUMN theFoo;
However, I get a "syntax error" and I'm assuming this has something to do with this column being a replication ID.
I'd rather not download the file and edit it directly using the MS Access application, but not sure if that's my only recourse.
Thanks so much in advance.
Regards,
Kris
If you have access to the database in a command shell, Michael Kaplan's Replication System Removal Fields utility should do the trick. However, I've found that in some circumstances, it's unable to do the job. Also note that the utility will only work with a Jet 4 format database (MDB), not ACE format (ACCDB).
If all else fails, you can recreate the table structure and append the existing data to it. That can get messy if you have referential integrity defined, though, but it will get the job done, and likely most of it is scriptable (if not all possible using just DDL).
Here is a link that may help you, I had a similar idea but when browsing the web found this
AccessMonster - Replication-ID-Field-size
EDIT: Well I don't have much time but what I was thinking of first was if you could alter the column to make it different (not a replication ID) and then drop it. (two separate actions). But I have not tested this.