Defendant BDR here attempts to appeal from an order denying its motion to dismiss this action for lack of subject matter jurisdiction because, defendant contends, this action must be a compulsory counterclaim in 80CVS89. We find that the order denying the motion to dismiss is an interlocutory order, and therefore we dismiss defendant’s appeal.
G.S. 1-277(a) provides that no appeal lies from an interlocutory order or ruling of a trial judge unless such ruling or order deprives appellant of a substantial right which he would lose if the ruling or order is not reviewed before final judgment. North Carolina Consumers Power, Inc. v. Duke Power Co., 285 N.C. 434, 206 S.E. 2d 178 (1974); see also G.S. 7A-27(d). While G.S. l-277(b) provides that appeal does lie from denial of a motion to dismiss for lack of personal jurisdiction, this does not apply to the denial of a motion challenging subject matter jurisdiction. A trial judge’s order denying a motion to dismiss for lack of subject matter jurisdiction is interlocutory and not immediately appealable. Shaver v. N.C. Monroe Construction Co., 54 N.C. App. 486, 283 S.E. 2d 526 (1981).
Although our Supreme Court has reviewed the denial of a motion to dismiss in certain cases, including North Carolina Consumers Power, Inc. v. Duke Power, supra, these cases “stand for *728the proposition that the appellate courts will entertain an appeal from an order denying a motion to dismiss in some cases and elect to review some cases on their merits, but this does not mean that the appeal from such interlocutory orders is any less fragmentary.” Shaver v. N.C. Monroe Construction, 54 N.C. App. at 487, 283 S.E. 2d at 527. We do not elect to entertain this interlocutory appeal. Defendant here may preserve its exception to the trial court’s failure to dismiss for lack of subject matter jurisdiction and assign that as error upon appeal from a final judgment entered in the cause. See Blackwelder v. State Dept. of Human Resources, 60 N.C. App. 331, 299 S.E. 2d 777 (1983).
On the facts before us, we are unable to find, as this court did in Atkins v. Nash, 61 N.C. App. 488, 300 S.E. 2d 880 (1983), that plaintiffs cause of action here was a compulsory counterclaim in the prior pending action. However, from the record now before us it appears that judicial economy would best be served by consolidating this action with 80CVS89.
Defendant’s appeal is
Judges Hedrick and Braswell concur.