Solved

editing recrods in SQL Server database

Posted on 2011-02-13
4
343 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
  • 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 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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