Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding an item to a production table in SQL

Posted on 2014-07-28
14
Medium Priority
?
284 Views
Last Modified: 2014-07-29
How can we add a simple type item to a production table in SQL Server Management Studio? We would just like to add in one item. We have included a file of the table for an example.
Untitled.jpg
0
Comment
Question by:regsamp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 40224044
For starters, when adding images to a question please use the Image control (far right in comment toolbar), and not the Attach File control, so that the question and the image can be viewed without forcing experts to click back-and-forth.

Now, what exactly do you mean by 'simple type item', as the image doesn't give any clues.  
Translation:  Explain in very simple non-technical terms what you are trying to pull off here.
0
 

Author Comment

by:regsamp
ID: 40224054
Untitled.jpg
We are trying just to type in a new PermitType in this table.
0
 
LVL 27

Accepted Solution

by:
Shaun Kline earned 1000 total points
ID: 40224064
Depending on the version of SQL Management Studio you are using, you can right click on the table and select Edit to add a row. Alternately, you can use a SQL Insert statement to add a new item.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 1000 total points
ID: 40224065
If ID is an identity field, which means a value is assigned when a row is inserted

INSERT INTO PermitTypes (PermitType) VALUES ('goo'), ('foo'), ('boo')

If ID is not an identity field

INSERT INTO PermitTypes (ID, PermitType) VALUES (659, 'goo'), (660, 'foo'), (661, 'boo')
0
 

Author Comment

by:regsamp
ID: 40224073
The version of Studio Management is 10.50 but right-clicking on the table I am not getting an edit to add a row.
0
 

Author Comment

by:regsamp
ID: 40224075
Okay, I will look at the INSERT example put up here. I was just hoping to quickly edit it
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 40224102
If you are 'hoping to quickly edit it', then Shawn's answer may work for you.  
Right-click on the table, Edit Top 200 rows, then edit the set directly.
If what you want to edit isn't in the top 200, then you'll have to do it via T-SQL.

Also, by 'edit', are you ADDING NEW ROWS, which is an insert, or CHANGING EXISTING ROWS, which is an update?Right-click on table..
0
 

Author Comment

by:regsamp
ID: 40224151
I am adding a new row and it is unfortunately not in the Edit Top 200 Rows. Can't you go down more rows?
0
 
LVL 27

Expert Comment

by:Shaun Kline
ID: 40224154
One correction to Jim's statement.
If the item is not in the top 200 rows, you can filter the list of items shown by using the "Show Criteria Pane" or "Show SQL Pane" (found in the toolbar: Criteria Pane looks like a grid, and the SQL Pane has SQL on it) and applying the desired filter. These items can also be shown/hidden using the matching option in the Query Designer -> Pane menu.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 40224156
No.  You'll have to execute the INSERT statements as described above.

Also, SQL Server is a database, and is not optimized for easy manual data entry.

Also, how many rows are you attempting to insert?  If its more than can be comfortably coded, then spell out where these rows currently exist, and we can recommend an import data/slightly different T-SQL solution.
0
 

Author Comment

by:regsamp
ID: 40224165
I am trying to add one row. It is a simple type of OUC. I thought I would be able to just type it in but okay, I will look at the INSERT
0
 
LVL 5

Expert Comment

by:Chris Watson
ID: 40226356
If you are adding and not editing a row, it won't be in the top 200 rows because it doesn't exist. Or am I missing something?

To add a new row, select the row with the asterisk in the margin and type in your new data.

Adding a row to an existing table in SQL Server Management Studio.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 40226549
Building on Chris' comment above, if all you're looking for is a low-brain method to add records to a SQL Server table, and nothing else, then how about creating an Access application, creating a linked table to the SQL Server table you're talking about here, then just opening the table and editing away.

This way you wouldn't have to deal with / install SQL Server.
0
 

Author Comment

by:regsamp
ID: 40226642
I ended up just trying it with INSERT and it is working fine. I was worried I would ruin the table but no issues. . Thank you for the update though Chris and followup Jim.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question