Hello Chao Pan,
Do you think it would be possible to use the Capture Mode ?
http://msdn.microsoft.com/en-us/library/ms162182.aspxI am not sure that this excellent page is related to the OP's question , but i am using this method when i am creating a full database ( i get the generated script and i write it in a "log file" with a StreamWriter ).
I would be grateful if you could give me explanations in case of getting wrong ( the best way to learn )
Have a nice day
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.