I’ve used this script by accident on the ‘master’ database instead of a temp database.
sp_msforeachtable 'delete from ?'
Has it caused any harm? If so, how can I restore the data?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No it shouldn’t have deleted anything (assuming you have no user tables in
master).Testing
Doesn’t return anything for me. So it seems to exclude the system tables such as
spt_values.Edit: Indeed Looking at the definition of the procedure it does only include tables where
OBJECTPROPERTY(o.id, N'IsUserTable') = 1