Do not use the second version, that will actually delete the table.
The first is roughly correct, but you need to used to parm coming back from "ForEachTable" instead of TableName
It's a little tricky, so I don't gaurantee this is exact.
exec sp_msforeachtable 'truncate table "?"'
The "?" with double quotes does the parameter replacement.