An example of the SQL Server syslanguage table application

zhaozj2021-02-16  52

-------------------------------------------------- ---------------------------------------------

Author: Weng Yan

Welcome to reprint, please keep this declaration information.

Welcome to me, enhydra_boy @ Tom.com

-------------------------------------------------- --------------------------------------------

Recently, in the 9CBS Forum, I answered two friends' questions before and after, I feel that it is necessary to summarize it.

The problem is like this

1 SQL Server 2000 is Chinese version, I want to display the date format in English?

2 SQL Server 2000 is Chinese version, want to buy Chinese and month name?

Let's analyze it, display the date format is definitely related to Language, and should be related to the current session Language setting, affirmation and server, whether the database is not related to Chinese and English.

Then the first question is very simple,

only need to

Set Language US_ENGLISHSELECT Convert (VARCHAR (20), Getdate (), 107) Set Language Simplified Chinese

The result is as follows

Changed language setting to us_english. -------------------- Sep 01, 2003

(The number of rows affects is 1 line)

It has changed language settings to Simplified Chinese.

But the second question, it seems that it will not work, we can test it.

Set Language Simplified Chinese

Select Convert (VARCHAR (20), Getdate (), 107)

It is

09 01,2003

It is not required for September.

This requires further analysis. The language supported by the database should have a corresponding date monthly short-write setting.

Master.dbo.sysLanguages ​​is the corresponding information stored.

You can view the structure of the following syslanguages.

What we care is to be two of the shortmonths and months. We see this article Simplified Chinese, Shortmonths, Months are 01, 02, 03, ....

So, no matter how you set up Language, the result is 09 and will not be September.

Solution, everyone thought. Yes, it is to modify the system table.

Userow update ',' 1'goreconfigure with override gourpdate dbo.syslanguagees set shortmonths = 'Jan, February, March, April, May, June, July, August, September, October , November, December, Months = 'Jan, February, March, April, May, June, July, August, September, October, November, December 'WHERE Name =' Simplified Chinese 'GOSP_CONFIGURE' Allow Update ',' 0'goreconfigure with Override Go

Then restart the database server.

Then run SELECT Convert (VARCHAR (20), Getdate (), 107) GO

-------------------- September 01, 2003

Select Convert (VARCHAR (100), Getdate (), 9) GO ----------------------------------- -------------------------------------------------- --------------- September 1 2003 11: 36: 25: 507AM problem solved.

It seems that many questions need to be careful, analyze, look at the documentation, and can solve it by hand.

转载请注明原文地址:https://www.9cbs.com/read-23632.html

New Post(0)