• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

editing recrods in SQL Server database

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
adamtrask
Asked:
adamtrask
  • 2
  • 2
1 Solution
 
Muhammad WasifCommented:
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
 
adamtraskAuthor Commented:
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
 
Muhammad WasifCommented:
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
 
adamtraskAuthor Commented:
Thank. I get it now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now