I need to have months in my language in this view. I try this:
CREATE VIEW countTask
AS
SET LANGUAGE Polish
SELECT COUNT(*), DATENAME(Month, startdate), YEAR(startdate)
FROM TBL_TASKS
GROUP BY YEAR(startdate), DATENAME(Month, startdate)
but it's not correct. Do you know how can I fix it?
Using SQL Server Management StudioIn Object Explorer, right-click a server and select Properties. Click the Advanced tab. In the Default language box, choose the language in which Microsoft SQL Server should display system messages. The default language is English.
Right-click the Views folder, then click New View.... In the Add Table dialog box, select the element or elements that you want to include in your new view from one of the following tabs: Tables, Views, Functions, and Synonyms. Click Add, then click Close.
Expand the Databases and select the database whose language you want to change. Right-click on the database name, click on Properties. Select the Options menu and change the Containment type to Partial from None. Change default Language to your desired language.
The simplest solution is to insert data in table as NVARCHAR data type, like below. Show activity on this post. @DipGirase - You should be able to mix unicode characters from any language, for example insert into MyTable(MyColumn) values (N'हैलो दुनिया english АВГДЄЅЗИѲ àèìòù') .
You can't pass a culture to DATENAME
and you can't SET LANGUAGE
in a view (as already mentioned by @Mike) but if you're on SQL Server 2012 or above you can use FORMAT
instead. Something like
SELECT FORMAT(GETDATE(), 'MMMM', 'pl-PL')
-----------
czerwiec
(1 row(s) affected)
MMMM
is full month nameMMM
is abbreviated formMM
is month number M
is month and day) FORMAT
https://msdn.microsoft.com/en-AU/library/hh213505.aspx
Date format strings https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
You can't put the set Language
inside the view. The view is universal. if you want to see the output from the view in Polish, Set Language Polish before you select from it:
SET LANGUAGE Polish
SELECT * FROM countTask
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