My Galaxy Tab 2 10.1 powers off each time I disconnect the power/sync cable or when I connect it to a AC power source. It just shuts off without warning.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.
Without further details, I believe you've got an issue with the port where you connect the cable that causes the device to shutdown.
Some short-circuit happens and the device gets turned off.
My recommendation, take it to repair with or without warranty. Don't let this continue much longer or the device eventually will get irreparably damaged.
Ps: Assuming you've tried another cable and power jack...