I don't really understand the difference between using one or other when creating a table in my SQL Server database. Is one safer or faster than the other when building a table?
I'm not sure that SMO covers every single attribute and property that you'd want to set for a table, and scrounging around to find them all can be an exercise in futility. Personally I would much rather use DDL (CREATE TABLE
, ALTER TABLE
, etc) not only because I don't have to look up all the properties but also because it helps me reinforce my knowledge of those commands for cases where I don't want to or can't use SMO. But that may just be a preference thing.
As for speed, no difference whatsoever unless you're measuring the parse/interpretation through the SMO layer with a nanosecond stopwatch. It's going to eventually build the same CREATE TABLE
command you would write yourself, and send that on to SQL Server.