How return time & number format using stored procedure whatever set in the Machine

  • How return time & number format using stored procedure whatever set in the Machine

    Following is my sp for getting current date format from Sql Server.

    if exists

    (select * from sysobjects where id = object_id(N'[HSP_GetDateFormat]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)

    drop procedure [HSP_GetDateFormat]

    create procedure

    HSP_GetDateFormat

    (

    @strDateFormat nvarchar(64) out,

    @iErr

    int out

    )

    as

    begin

    set nocount on

    set @strDateFormat = (select dateformat from master..syslanguages where langid = (select value from master..sysconfigures where comment = 'default language'))

    set @iErr = @@Error

    set nocount off

    end

    Now, I want to know what would I write if I want to get current time & number format from Sql Server.

  • Please, give an example of the required output.

    ML

    ---
    Matija Lah, SQL Server MVP
    http://milambda.blogspot.com

  • There is no such thing as a time and date format in SQL Server.

    Assuming you have a datetime datatype, how the values from this will be displayed is up to the settings of the tool you use to retrieve the data. SQL Server itself has no notion of any format as we mortals read dates and times. The format for display is chosen at retrieval time.

    For more info on different date formats, look in BOL under the subject 'CONVERT'

    /Kenneth

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

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