• you can just convert the whole thing and strip out the characters. milliseconds is 3 digits so you'll have to truncate the result from 17 to 16 digits.

    select substring( replace(replace( replace(replace( convert(varchar,getdate(),121),' ',''),'-',''),':',''),'.',''), 1, 16 )