Table Rows Missing (not shown) after updated with a query

Copper Contributor

I ran into a situation and wonder whether someone knows how to fix it.

 

I am using Microsoft SQL server Management Studio to update the database.  There is one row which I could see but could not update because it is more than 200 rows (I did learn my lesson and I would change the option instead next time). 

 

Anyway, I applied following query:  "Update [ccnetwork_mdl].[dbo].[mdl_message] set useridto='286' where id='3140';"  And ever since that, all rows where useridto field is "286" could not be seen by the "SELECT" query.

 

Any suggestions would be appreciated!

2 Replies

 


@Shih-Hua Fu wrote:

I ran into a situation and wonder whether someone knows how to fix it.

 

I am using Microsoft SQL server Management Studio to update the database.  There is one row which I could see but could not update because it is more than 200 rows (I did learn my lesson and I would change the option instead next time). 

 

Anyway, I applied following query:  "Update [ccnetwork_mdl].[dbo].[mdl_message] set useridto='286' where id='3140';"  And ever since that, all rows where useridto field is "286" could not be seen by the "SELECT" query.

 

Any suggestions would be appreciated!


Good day echShih-Hua Fu,

 

I can give you a lot of suggestion but these will not fit your case probably as I have no idea what is your case. You did not gave us any information regarding your database structure. We don't event know if you havce a column name "id" and what is the relation between the column "id" and the column "useridto"

 

If you want to get help min forums you should remember that we cannot see your system and we have no mind reading ability (I don't have at least) therefore, you should always post:

1) Queries to CREATE your table(s) including indexes
2) Queries to INSERT sample data.
3) The desired result given the sample, as text or image of excel for example.
4) A short description of the business rules, and how you got 1-2 of the results
5) Which version of SQL Server you are using (this will help to fit the query to your version).

 

Regards,

Thank you so very much for responding to my question!

After trying to answer those information you said I should include in my post, I came upon an old page which I applied to retrieve the information from the table. It turned out that this table is supposed to keep only unread messages. What happened was, when I update the specific entry, this person [useridto='286'] who happened to open and read all messages received. And that action wiped out all entries which useridto is '286' from this table. That is why.

I do appreciate your kindly advice. Without you, I would probably still stay panicky and helpless. Really thank you!!!