I work on sql server 2017
i need to delete all rows from table student_course
but i don't know use
delete from student_course
or
truncate table student_course
table student_course
studentid pk
courseid pk
table student table
studentid pk
table courses
courseid pk
---------------------------------------------
student_course table have relation with courses table and student table
so which command will be used to delete all rows from table student_course
truncate or delete ?
Sachin SinghPosted Aug 28, 2022, 7:51 AM
Rajanikant HawaldarPosted Aug 28, 2022, 5:39 AM
Uttam KumarPosted Apr 28, 2022, 8:34 AM
You can use either one delete or truncate. Both will delete all the data from the table.
Upon deletion using Delete command will only delete all the data where as using Truncate command will not only delete all the data but reset the table to initial state.
Muhammad Imran AnsariPosted Apr 27, 2022, 6:35 PM