?
Solved

editing recrods in SQL Server database

Posted on 2011-02-13
4
Medium Priority
?
367 Views
Last Modified: 2012-05-11
Hi,

I am using the following SQL statement in Sql Server Management Studio to retrieve the top 5 records. However, the statement displays the records but does not allow me to edit any of them.

select top (8)dDate,nName,tType from Main;

My question is how do I modify the above statement to be able to edit any of the records displayed. Thanks
0
Comment
Question by:adamtrask
[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
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 34882756
I never used SQL Server, you may need to include primary key too (also try *) to be able to edit the record. Editor must have a unique identifier to each row to update it.
0
 

Author Comment

by:adamtrask
ID: 34882782
Even when I include the primary key column as in the following statement the records displayed are read only. I am not allowed to edit any of the columns.

SELECT    TOP (10) ID, dDate, tTime, nNAMe, sSubject, tType, mMonth, Remarks
FROM  Main1
0
 
LVL 20

Accepted Solution

by:
Muhammad Wasif earned 2000 total points
ID: 34882825
A solution is already posted here

If you want to change the Edit Top <n>, go to Tools -> options, select the SQL Server Object Explorer -> Commands and it is in there.

But I would still do an update the way Rob says as it's much easier than manually editing and you are less likely to have moments of human error.
0
 

Author Closing Comment

by:adamtrask
ID: 34882871
Thank. I get it now.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

770 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