Microsoft.SqlServer.Management.Smo.PartitionFunction.ScriptCreate generates syntactically invalid statements for non-numeric data types
A colleague of mine recently came across this one problem for which I have filed a code defect so that it gets fixed in a future release.
If you have a partition function whose range values are of a non-numeric data type, the generated script will lack the single quotes surrounding the literals so it will be syntactically incorrect. An example of such partition function would be the following:
CREATE PARTITION FUNCTION [TestPartitionFunction](datetimeoffset(7)) AS RANGE FOR VALUES ('1/1/2007 12:00:00 AM +00:00', '1/1/2008 12:00:00 AM +00:00', '1/1/2009 12:00:00 AM +00:00')