leaders_j that code snippet you have is really old; i bet it's from 5 years ago.
It's from a project i play with now and then that scripts any table via TSQL.
are you trying to script the CREATE table statements?
i've got some really advanced versions of that code since i wrote that, that are no longer cursor based.
try this version for now:
my newest version (v309) scripts any object act all(procedure/function/table/view etc.
I should note that everything my script does, the GUI does, and probably better, but i love writing my own solutions.
Lowell