I need to switch between languages inside body of table-valued function to return month names and weekdays in different languages. But when I try to use SET LANGUAGE RUSSIAN
I get Invalid use of a side-effecting operator 'SET COMMAND' within a function.
error.
Why this happens while setting variables in TVF is OK? How can I change languages inside TVFs?
You can't use set language
inside a function.
What version are you on?
If 2012+ you could do
SELECT FORMAT (GETDATE(), 'dddd', 'ru-RU'),
FORMAT (GETDATE(), 'MMMM', 'ru-RU')
instead. (Returns вторник, Сентябрь
at day of answering).
On previous versions you could write a CLR function that does similar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With