Skip to content
Advertisement

Casting datetime to varchar in scalar-valued function SQL Server 2005

I’m trying to get the following statement executed. The scalar-valued function is expecting a varchar for the date and the original column in customertable is a datetime. I’ve done my research and looked around; the various solutions I’ve tried haven’t worked.

When I run this:

I get this error:

Conversion failed when converting character string to smalldatetime data type.

UPDATE: function code

UPDATE: some of the values in DATE_COL are null. ive just confirmed that.

Advertisement

Answer

You are passing your params in the wrong order to function..

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement