Table doesn't show in list of tables in SSMS query designer GUI after table creation script - sql

If I create a table with a script in SQL Server Management Studio, then the table won't show up in the list of available tables when using the Query Designer (right-click "Design in Query Editor" or Ctrl+Shift+Q when in a query worksheet).
It shows up in the list of tables in the correct database after refreshing. I have tried both refreshing the table list, refreshing the intellisense from the context menu and keyboard shortcut, and even connecting and reconnecting.
The only thing that fixes it is completely restarting SSMS.
Is there a way to get the new table to show up without restarting or reconnecting?
I am using SSMS 2012, but I assume it applies to other versions as well.

Right click on the database name then select new query will change the query file name to servername.DBname
it helps to open tables in query designer table

Related

in SSMS, is there any way to preview table contents without writing a query?

Browsing table contents in SQL Server Management Studio (SSMS) doesn't seem as easy as it should be. In contrast to other client software I have used, I can't find a way to simply click on a table and view its top rows (i.e. preview it).
The closest is to right click and "SELECT Top 1000 Rows" but not only is that two clicks, more importantly it opens a new query tab. If I'm browsing a lot of tables, I end up needing to juggle a lot of unnecessary tabs.
Is there a better way?
Currently in SQL Server Management Studio there is no functionality like this built in. You are correct that the only way to view the data content is right click on the table name in Object Explorer and SELECT TOP 1000 ROWS. There are some 3rd party tools that might have a PREVIEW functionality but this is not in SSMS.
What you can do is to select on the table in the query tab and right-click and then "design query in the editor"

Created Table showingup in Object explorer but not in sys.tables

Recently I run into a scenario, where
I created a table in a database.
Refreshed the tables in Object explorer
Table appeared in the list
I used the query 'select * from sys.tables' and selected the database in dropdown list
Executed the query
Table NOT in the list
We are using SQL server 2008 R2 and this issue is observed on our clients machine. Sadly, I don't know much about the history of the database.
Has anyone seen this issue before. Any little help will be greatly appreciated
Finally figured out the issue..
Issue is because we are using remote connections. It seems SQL query editor will remember the connection. So query editor is using one connection and Object explorer is using a different connection. They both are not pointing to the same server.
So when we created a table using SSMS, then we can see the table created, but not the same when used with query editor. As both the servers has same databases we always thought that it's the same server.
To change the connection of query editor, Right click on the sql query editor -> Connections -> Change connection.
With this we changed the connection of the query editor. And now both Object explorer and query editor are in sync, and we can see the table that is created.
Happy ending!!
#Mortb and #Manngo, once again many thanks for your contribution..

Cannot create new SQL data tables in Visual Studio Express 2012

I have created a new SQL database in my Visual Studio Express 2012 website. This appears in the AppData folder. I can open the database in the Database explorer and now I want to add some empty data tables.
I right click on the Tables folder and select Add New Table. I get the screen (below). When I have finished I click Update and it appears to do something but then the table has not appeared in the Tables folder.
I have also tried clicking the save button, and saving the table manually in the AppData folder, but yet it still does not appear in the Tables folder.
What am I doing wrong please?
Here is the solution-
https://www.youtube.com/watch?v=HwA-tNvU3hw
Steps 1-Change the name of table [dbo].[table---(change this)]
Step 2-Don't save the table after creating them rather choose option update table and then update database.
Step 3-On refreshing the tables you will be able to see your table.
In my case, Visual Studio was saving the table to my documents. It should be writing the table to the MDF file. I used the designer to generate the T-SQL, then I copied the T-SQL right clicked on the tables folder, chose 'New Query' pasted the T-SQL commands, set the target database as shown in the image and ran the query. Finally!
In the 'New Query' window within VS 2012 Express, there is an 'available databases' drop down. Choose your database that is part of your solution and execute the T-SQL
Have you tried refreshing the tables list on the right hand side?
Make following change:
CREATE TABLE [dbo][change_this_name]
click the update button on top left corner.
I was up against this same problem in Visual Studio 2013 Community. The solution was to go to Tools -> Extensions and Updates and then download the SQL server compact / sql lite toolbox. VS2013 will prompt you to restart for the new extension to take effect.
After the restart, your databases will have a red "x" on them. Right click them, select modify connection and then take the defaults.
Visual Studio will then pull its head out of its hind parts, and those tables you've been saving that never appeared in the tables folder before will be auto-magically there.
Hope this helps.

In SQL Mgmt Studio I can run a query from object explorer but no from the design window

In SQL Mgmt explorer 2008 against a 2008 database, when I right click a view and click select top 1000 rows everything works. I can even change it to view all rows by deleting the "TOP 1000" and re-executing the view.
But, when I right click the view and click design and then execute the view, it has an execution error with a bunch of multi-part identifier could not be founds.
It is a fairly complicated query that has many joins.
It has been working for many years and is still working. But i need to edit the query and it won't let me design and test it.
Any ideas?
In the TOP Left of management studio you should have a drop down list with all the databases.
Is the correct database selected?

Generate changes script

Let's imagine I added new column for some table in SQL Server Management Studio. Is there any way to get change script which is executed when I press save?
What I want to achieve is to apply the same change to other databases (we have a separate database for each developer for debuggin purposes).
I assume you are using table designer in MS SSMS.
Do the changes in the designer and just before hitting Save, go to the Table Designer menu and select Generate Change Script....