how to change the number of date in the same way collation does for varchar.

  • Hi

    I have seen collation affects var char, I need to change the date and number and currency also in the same language but found that after using the set language it affects the text of the date not the number,

    is there any way that I can change the number, currency or number part of date? like can we see numer of the date part in arabic or roman

  • I'm not exactly sure what you're asking but, no matter the language, dates and times are stored as (binary data) Integers behind the scenes.  How they're presented is totally up to the language assignment.  The same is true for currency, numerics, etc.

    If you use CONVERT to format the date, that will follow the "language".  Do a SELECT * FROM sys.syslanguages to see what it'll return for the languages of your choice and look up CONVERT to see the date formats of choice.

    I strongly recommend that you do NOT use FORMAT for such a thing because it's 17 to 27 times slower on modern machines.  See the following article for more on that..

    https://www.sqlservercentral.com/articles/how-to-format-dates-in-sql-server-hint-dont-use-format

    • This reply was modified 1 year, 8 months ago by  Jeff Moden. Reason: Added some clarification

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • thank u,

    One more clarification , i have seen collation does not affect nvarcahr, but according to me the style part of collation that is" _CP1_CI_AS" affects nvarchar( i am not sure pls conferm then how sorting is done for nvarchar) , and i think it is the style part of collation ex . this is the collation " SQL_Latin1_General_CP1_CI_AS"  it has designator part "SQL_Latin1_General" and style part "_CP1_CI_AS"

    so pls conferm this that the this style part is the only configuration which affects or it has some other story?

  • This was removed by the editor as SPAM

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply