SQL Server Performance Forum – Threads Archive
user-defined datatypesI was wondering why I can’t use a user-defined datatype in the CAST() or CONVERT() functions, if anyone knows.
By default UDFs cannot be used in CAST & CONVERT. Being UDFs are system based ones you have to use system data_types. Satya SKJ
Maybe I’m getting my terminology mixed up…isn’t UDF a function? I was talking about datatypes. For example, if I created a datatype called "typeDateString", such as: sp_addtype typeDateString, ‘VARCHAR(11)’, NOT NULL Why can’t I use that in convert: CONVERT(typeDateString, GETDATE(), 101) Is there a way around this? Or am I just being lazy?
Instead use VARCHAR directly in CONVERT function, by design User defined datatypes are not allowed. Satya SKJ –Apologies for mentioning UDFs read as user defined datatypes on previous post.