Editing table/adding records manually to sql server 2005
Is there any option in sql server 2005 management studio to change columns in a table by hand and by the sq开发者_JAVA技巧l commands alter table or insert into.
If yes, then could someone please show how or link to some instructions?
Sure you can.
If you want to rename columns you'll need to use sp_rename. Check this link out:
http://blog.sqlauthority.com/2008/08/26/sql-server-how-to-rename-a-column-name-or-table-name/
HOWEVER, there's a big caveat: if you use this column from within any stored procedures, functions, views, etc., they're all going to break so I'd recommend using a tool such as SQL Refactor from Red Gate Software (disclaimer: yes, I work for Red Gate) which will rename the column along with all its usages elsewhere in your schema. You can find out more and download SQL Refector from:
http://www.red-gate.com/products/SQL_Refactor/index.htm
(The tool comes with a 14-day fully functional free trial, if you want to give it a whirl.)
If you want to perform other actions, such as adding or removing columns, you'll need to use the ALTER TABLE statement (lots of examples at the bottom of this page):
http://technet.microsoft.com/en-us/library/ms190273%28SQL.90%29.aspx
If you want to change the data in a column you'll need to use the UPDATE statement:
http://technet.microsoft.com/en-us/library/ms177523%28SQL.90%29.aspx
Hopefully that helps, but if I've misunderstood, please let me know.
Not sure what you are asking, you can right click the table and open it and manually enter data. If you need to edit it, just right click it and choose Design Table. If you want to issue a change to it via SQL you can issue an ALTER TABLE MYTable.
In object explorer, if you navigate from
* [Server]
* Databases
* [Specific DB Name]
* Tables
* dbo.[Tablename]
And then right click on table, the context menu has a choice called "Edit Top 200 Rows". Is that what you're looking for?
If you want to manually add or edit a row. right click the table and click open. this will bring back the table with contents wich can then be added to or edited.
You can change the structure of the table by clicking Design, rather.
You can then also view the generated script of these changes if you like.
Open up your Database > Tables. Right-click on your table and select Edit. This will bring you to your straight SQL syntax entry.
Or you can go to Databases > Tables, Right-click on your table and select Design. This will bring you to a simple GUI to modify your table.
精彩评论