Why SQL Server 2008 Management Studio doesn't have option "Open table" - sql

I used to have option to open table in SQL Server 2005 Management Studio, but don't have that anymore in the 2008 version. Does anybody know why this option has been removed? And, if this feature is no longer available in the 2008 version, what is the best alternative to use?

Now it's Edit Top 200 rows.
They did this cause people were opening huge tables without thinking.
If you want to see 2000 rows, you can edit the select query when you right click -> pane -> SQL.
Then in your sql statement you will see Top(200). you just have to change to the number of rows you need.

The option is still there, it's just been renamed. I believe the old version used to attempt to get every single record in the table. The revised SSMS will, by default, get only the first 200.
Right-click a table and select Edit Top 200 Rows as shown below:

its good to change it like-
tools-> options ->SQL server object explorer -> commands --in this we can edit for whichever rows..

Related

Copying an SQL table from one Server to another on SQL Server 2000 / 2005

I’m trying to copy a SQL Server table, schema and data, from Server A to Server B. The SQL Server table is just a reference table which hasn't been populated for some reason on Server B. Can anyone advise how the entire table could be copied across please? On SQL Server 2000/2005.
So far we've tried a long-winded approach by copying the .mdf and .ldf files from Server A to Server B with a plan to then copy the table across into the Server B database but we are having some difficulty re-attaching the database to Server B.
Please can anyone help?
Kind Regards
James
Using SQL Server Management Studio (SSMS):
In Object Explorer right click on source database name, Tasks.. -> Generate Scripts.. - opens Generate and Publish Scripts dialog. Click Next to choose objects, choose "Select specific DB objects", expand Tables, choose your table. Next, setup script destination, for example New query window and (important step!!) - click Advanced, and set "Types of data to script"="Schema and data" and "Script USE DATABASE"=False, OK, Next, Next, .. wait .. Finish. Now you have got complete SQL script to reproduce this table with data. Connect to destination DB and run it.
Tested with SSMS 2014, but as I recall this feature should be available starting from SSMS 2005.
you can use the import/export data wizard in management studio, the wizard will create for you a new table in the server B with the same structure of the table in the server A. before using it you need to have at least one database in sever B.
This confirms why this is one of favourite forums.
Both these methods work beautifully :
Generate Scripts (when altering Types of data to script"="Schema and
data")
Export and Import
Interestingly Generate Scripts works with SQL Express perfectly but the Export method does not save unless you have at least SQL Server Standard Edition.
Thanks so much everyone
Cheers
James
Try this:
SELECT * INTO destination FROM source
But, it will not copy the indexes and key information or you can also try import/export data task from SSMS.

Is there an SQL editor for the data itself?

I'm looking for an SQL (MSSQL) tool that will allow me to edit/insert/etc. data without the need to type sql statements. I want to simply enter data into a grid. I can't find this functionality in SSMS. Is there any tool that does that (preferably by MS)?
Table Editor
If you right-click on a table in SSMS and click edit, you can edit the data in there directly.
Query Designer
If you select a row or cell in the table editor, you have access to the Query Designer menu on the tool bar. By clicking on the pane menu, it will open a sub-menu that will give you access to the SQL, Criteria and a Diagram. This will allow you to design queries visually.
SSMS does let you do it, although it's not a great tool by any stretch. If you right click on a table and go to Edit Top 100 rows, you can get the grid. If you want to be able to edit any number of rows, go to Tools -> Options -> SQL Server Object Explorer -> Commands and change both values in the Table and View options to 0, which means unlimited.
You can also edit the query that is used to generate the grid. In the toolbar, there's a button that says SQL and the hovertext is "Show SQL Pane". You can then edit the SQL to include/exclude columns or add conditions. This may help with large tables. You can also use this method to overcome the row number limit if you didn't change the defaults as in the above paragraph.
Right click the table in SSMS and click Edit Top 200 Rows:.
Using MS SQL Managment Studio you can right click on a table and select Edit. This will let you edit existing rows and add new rows by just typing into the 'grid'.
try this. may be this can help
http://www.toadworld.com/platforms/sql-server/w/wiki/10392.editing-an-sql-server-table-in-excel.aspx
A real easy thing to do is to use Access as a front end to SQL Server. It would take only a few minutes to create an ODBC connection from Access to SQL Server and you can quickly use Access's grids and forms to enter data.

SQL Server 2012 intellisense works for first query in a window

My problem is that when I write a query in sql server on a sheet I get intellisense for the first query and only the first.
If I was to write a query directly below the first, I get no intellisense at all. I could put my cursor back to the initial query and get intellisense once again.
For example, this is a single query sheet:
select t.* from table1 t; --Intellisense, yay!
select t.* from table2 t2; --no intellisense, ;(
What is going on here? I have turned off SQLCMD Mode, I read this will mess up the intellisense, also I have changed the maximum script size around - all to no avail.
Any help would be appreciated, thank you!
the problem is SSMS reads the second query as an error. I know you can comment out the top one and get intellisense on the bottom on. Really sucks when you have a huge server.
if you are working on a remote server you as many people that use SSMS 2012 have to wait a patch from Microsoft.
Otherwise here you can find a list of setup to check.
Best regards,
Danny
One possibility - If you have installed Visual Studio 2010 Service Pack 1 then it will definitely break SQL server intellisense. To resolve the issue install the latest service pack for your SQL server. Read this article here - https://support.microsoft.com/en-gb/kb/2531482

SQL- Editing the 10 most recent rows in a table [duplicate]

In SQL Server 2008 Management Studio, when I right click on a database table and choose Select Top 100 Rows, I can then e.g. easily add a ORDER BY statement to the SQL. That works fine.
But when I do choose Edit Top 200 Rows, I don't have the ability to alter the SQL (which makes it hard to find and edit a record just added in the 10,000 that are there.
I am quite sure I was able to do this in SQL Server 2000.
Is there any way in SMSS 2008 to alter the way the records are displayed when editing records?
If you right click on any result of "Edit Top 200 Rows" query in SSMS you will see the option "Pane -> SQL". It then shows the SQL Query that was run, which you can edit as you wish.
In SMSS 2012 and 2008, you can use Ctrl+3 to quickly get there.
You can also change the pop-up options themselves, to be more convenient for your normal use. Summary:
Run the SQL Management Studio Express 2008
Click the Tools -> Options
Select SQL Server Object Explorer . Now you should be able to see the options
Value for Edit Top Rows Command
Value for Select Top Rows Command
Give the Values 0 here to select/ Edit all the Records
Full Instructions with screenshots are here: http://m-elshazly.blogspot.com/2011/01/sql-server-2008-change-edit-top-200.html
Very quick and easy visual instructions to change this (and the select top 1000) for 2008 R2 through SSMS GUI
http://bradmarsh.net/index.php/2008/04/21/sql-2008-change-edit-top-200-rows/
Summary:
Go to Tools menu -> Options -> SQL Server Object Explorer
Expand SQL Server Object Explorer
Choose 'Commands'
For 'Value for Edit Top Rows' command, specify '0' to edit all rows
Follow the above image to edit rows from 200 to 100,000 Rows
Ctrl+3 in SQL Server 2012. Might work in 2008 too
in SQL 2017 You can do it more easily in the toolbar to the right just hit
the SQL button then its gonna apear the query with the top 200 you edit until the quantity that You want and Execute the query and Done! just Edit
Similar to David Hall's response, if you are a non-coder, it may be easiest to right-click within results, then choose Pane > Criteria. This allows you to adjust sort, add filters, etc... without adjusting SQL code.
The default to open/add rows to a table is Edit Top 200 Rows. If you have more than 200 rows, like me now, then you need to change the default setting. Here's what I did to change the edit default to 300:
Go to Tools in top nav
Select options, then SQL Service Object Explorer (on left)
On right side of panel, click into the field that contains 200 and change to 300 (or whatever number you wish)
Click OK and voila, you're all set!

How do I export a table's data into INSERT statements?

How can I export a table from a SQL Server 2000 database to a .sql file as a bunch of INSERT INTO statements?
One of the fields in the table is a Text datatype and holds HTML so doing this by hand would be rather time-consuming.
I have access to SQL Server Management Studio 2008 to access the SQL Server 2000 database.
Updating since this Q&A was at the top of the search results when I was looking for the answer.
In MSSQL 2008 R2:
Right Click on database: Tasks -> Generate Scripts...
The Generate and Publish Scripts dialog will pop up. The Intro page is worthless. Click "Next"
Choose "Select Specific database objects" and then select the Table(s) you want to get Inserts for. Click Next and the dialog will advance to the "Set Scripting Options".
Click on Advanced and you should see:
Scroll down the list of Options until you find "Types of data to script". Click on that row and choose "Data Only" from the pull-down. Click "OK". Choose your Save options and click "Next" a few times.
Note - The output also includes the following after every 100 inserts.
GO
print 'Processed 200 total records'
Check out the SSMS Tool Pack - it's a great, FREE add-on for SQL Server Management Studio which does a lot of things - among other it can generate INSERT statements from a given table.
I have been using this stored procedure for a long time: sp_generate_inserts: the 2000 version and the 2005 (and up) version.
You use it like this:
sp_generate_inserts 'thetablename'
or if you want to filter:
sp_generate_inserts 'thetablename', #from='from ... where ... order by ...'
The sp will return inserts statements as query results. Don't forget to modify setting: increase the maximum number of characters displayed in each column (tools - options - query results).
If you can use other DB management apps the quickest way would be using a tool like SqlDbx which has a built-in "Export as inserts (SQL)" function (just execute a query like SELECT * FROM Table and then use the contextual menu from the result grid).
If you need to stick to SQL Management Studio then you could use a stored procedure like this one:
http://vyaskn.tripod.com/code/generate_inserts.txt
It generates a set of results with the SQL INSERT statement for each row of the target table. Then you can exports the results to a file, or just copy them to the clipboard and paste in the query window (it works fine even with several megabytes of data).