I have created a scalar-valued CLR UDF (user defined function). It takes a timezone id and a datetime and returns the datetime converted to that timezone.
I can call it from a simple select without problems: "select dbo.udfConvert('Romance Standard Time', @datetime)" (@datetime is of course a valid datetime variable)
But if I call it passing in a datetime from a table it fails: "select dbo.udfConvert('Romance Standard Time', StartTime) from sometable" (column StartTime is of course a column of type datetime)
The error message is: "Cannot find either column "dbo" or the user-defined function or aggregate "dbo.udfConvert", or the name is ambiguous."
This message is really for beginners that has misspelled something, but as it works in one case and not in the other, I don't think I have done any misspellings.
Any ideas?