Setting date format for the entire SQL Server installation - SQL Server 2008 R2-2012

Hi,
I need to safeguard the behaviour of SQL codes that inserting into SQL tables with some date columns. For this purpose, I need to change the date format for the SQL instance and not using CONVERT and CAST.
I've seen the SET DATE FORMAT statement, but if I use it, could I solve my problem?
Thanks

The language setting is related to the database user.
BOL: "DEFAULT_LANGUAGE = { NONE | <lcid> | <language name> | <language alias> }              
Specifies the default language for the new user. If a default language is specified for the user and the default language of the database is later changed, the users default language remains as specified.
If no default language is specified, the default language for the user will be the default language of the database. If the default language for the user is not specified and the default language of the database is later changed, the default
language of the user will change to the new default language for the database."
LINK: http://technet.microsoft.com/en-us/library/ms173463.aspx
The default language setting can be overridden by SET LANGUAGE for the session:
http://technet.microsoft.com/en-us/library/ms174398.aspx
Example:
SET LANGUAGE us_english; -- mdy
SELECT CAST ('12/13/2014' as DATE); -- 2014-12-13
GO
SET LANGUAGE british; -- dmy
SELECT CAST ('12/13/2014' as DATE);
GO
(1 row(s) affected)
Changed language setting to British.
Msg 241, Level 16, State 1, Line 2
Conversion failed when converting date and/or time from character string.
Kalman Toth Database & OLAP Architect
SELECT Video Tutorials 4 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • How to handle Multiple date formats for the same date field in SQL*Loader

    Dear All,
    I got a requirement where I need to get data from a text file and insert the same into oracle table.
    I am using SQL*Loader to populate the data from the text file into my table.
    The file has one field where I am expecting date date data in multiple formats, like dd/mon/yyyy, yyyy/dd/mon, yyyy/mon/dd, ,mm/dd/yyyy, mon/dd/yyyy.
    While using SQL*Loader, I can see Loading is failing for records where we have formats like yyyy/dd/mon, yyyy/mon/dd, mon/dd/yyyy.
    Is there any way in SQL*Loader where we can mention all these date formats so that this date data should go smoothly into the underlying date column in the table.
    Appreciate your response on this.
    Thanks,
    Madhu K.

    The point being made was, are you sure that you can uniquely identify a date format from the value you receieve? Are you sure that the data stored is only of a particular limited set of formats?
    e.g. if you had a value of '07/08/03' how do you know what format that is?
    It could be...
    7th August 2003 (thus assuming it's DD/MM/RR format)
    or
    8th July 2003 (thus assuming it's MM/DD/RR format)
    or
    3rd August 2007 (thus assuming it's RR/MM/DD format)
    or
    8th March 2007 (thus assuming it's RR/DD/MM format)
    or even more obscurely...
    3rd July 2008 (MM/RR/DD)
    or
    7th March 2008 (DD/RR/MM)
    Do you have any information to tell you what formats are valid that would allow you to be specific and know what date format is meant?
    This is a classic example of why dates should be stored on the database using DATE datatype and not VARCHAR2. It can lead to corruption of data, especially if the date can be entered in any format a user wishes.

  • Date Format for the input Variable

    Hi all,
    I got an issue with Date format we enter in the input variable screen for the BEx Analyzer.
    We have given a format of MM/DD/YYYY. But when the users accessed the report, it is not taking the format of the variable i.e MM/DD/YYYY but it is taking the format of the users system.
    If the user's system format is DD/MM/YYYY, it is accepting the input inthe same format only.
    Why this strange behaviour?
    My questions are
    Is the input for BEx system specific? or variable specific?
    Rgrds
    Kumar

    Hi,
    I think it is user specific... you can maintain the date format for user ....
    Go to SU01 transaction or.. Go to SYSTEM -> User Profile -> Own data
    Here in defaults tab you can see the date formet for user...
    Hope this helps...
    Thanks,
    Vikrant Mahajan

  • Setting proper format for  the documents

    Hi,
    I want to set the proper format before saving the documents in Ifs. The Documents are uploaded to Ifs using the Java API.Can any one help me on this?
    Thanks,
    Prasanth

    Hi,
    Thanks rich. I am using the following code to set the proper format.
    // create the definition
    DocumentDefinition ddef = new DocumentDefinition(lsession);
    ddef.setName(docname);
    ifsSession.setAdministrationMode(true);
    FormatDefinition newFormatDef = new FormatDefinition(lsession); //create a new FormatDefinition
    Format format = (Format)ifsSession.createSystemObject(newFormatDef); //create a new Format using the FormatDefinition
    format.setMimeType(mimetype); // set Mime type for the Format
    newDocDef.setFormat(format); //set the format for the DocumentDefinition
    lsession.setAdministrationMode(false); //set the session back to normal mode;
    // create the document using the definition
    Document newdoc = (Document) lsession.createPublicObject(ddef);
    Is there anything wrong with this one? when i save the document with this code,its stored in non-indexed media.
    I tried the code you posted .its working for pdf documents (they are going to indexed Media ) but not for word documents.
    Thanks,
    Prasanth

  • Change number / date format for the user at run time

    Hi,
    Can I configure a report in Oracle Answers to display a column in a particular format for one group of users and a different format for another group of users?

    Hi,
    Yes this is possible.
    In the BMM layer duplicate column which is to be formatted for different group of users. And pull it into the presentation layer.
    Suppose Column 1 for the Group 1 users
    and Column 2 for the Group 2 users
    In the presentation layer, double click on the column and give permission for the column 1 for the group 1 users and group 2 users for column.
    First create a report with all the desired columns with Administrator or Presentation Server Administrator Role. And format the columns according to the different group of users.
    In, NQSConfig.ini change the parameter PROJECT_INACCESSIBLE_COLUMN_AS_NULL which is under security section. By default it is set to No. Set it to yes. And restart the services.
    Now logon with the group 1 users and you can see only the column1 and when logged on with group 2 users, you can see the column2.
    And will solve your problem.
    Please let me know if you need step-by-step process for solving.
    Please award if you found this useful/helpful
    Regards
    MuRam

  • In Thunderbird, how do I change the date format for the column display?

    I want the date to show as DD-MM-YYYY HH:MM AM/PM. Although this should be really obvious (and I know I've done it in the past), I can't find where to do this and can't find anything in Thunderbird Help on this, not even when I search "Thunderbird, change date format".

    Thunderbird usually uses the computer date and time and settings.
    I'm using Windows and notice that TB is using the short date format which I set up under Regional & Language Options.
    Are you using the International settings or Date/Time settings?
    It should pick up the settings from the 'International' or maybe its called now called 'Language & Text' setting.
    not sure which of these suits your macbook:
    http://www.macyourself.com/2008/08/31/modify-the-default-clock-in-os-xs-menu-bar-to-show-the-full-date/
    http://www.dummies.com/how-to/content/language-text-preferences-on-your-macbook.html
    http://www.dummies.com/how-to/content/how-to-change-your-macs-date-and-time.html
    http://www.youtube.com/watch?v=2zBMl8Vb3wc
    http://support.apple.com/kb/TS3579

  • Is there a wayto set a passcode on one's ipad e mail alone or do you have set a passcode for the entire i pad

    is there a way to set a passcode on one's ipad e mail or do you have to lock the entire ipad?

    You cannot passcode lock the mail app with any feature of the iOS.. There is an app that will let you passcode mail but I have no idea how well it works. You can check it out.
    http://itunes.apple.com/us/app/mail-locker-keep-your-mail/id449844544?mt=8
    If that doesn't work for you, then you have would have to passcode lock the iPad in order to prevent anyone from seeing your mail.

  • How to use the date format for the given req.?

    I have a requirement which should fetch the datas given by user. The user parameter is the date. The date will fetch the amount of the customer code for that particular month based on the date upto given by the user of that financial year.
    If the user parameter is given as 200703(YYYYMM) it should fetch the datas of the financial year from 200604(YYYYMM) to 200703(YYYYMM). The logic is the user parameter year should fetch the datas of previous year till the user given date and the month should be also do the same. Please do the needfull oracle experts.
    Regards,
    Mark

    As i am new to oracle i need help from you experts, The year and the month as seperate columns both as different data type as number and varchar2. There is no date column in the table.
    Table GTemp:
    DIVISION_CODE NUMBER(2)
    GL_CODE NUMBER(6)
    FINANCIAL_YEAR NUMBER(4)
    FINANCIAL_MONTH VARCHAR2(2)
    Query that i have used:
    SELECT ALL GTEMP.FINANCIAL_YEAR, GTEMP.FINANCIAL_MONTH, GTEMP.GL_CODE
    FROM GTEMP
    WHERE financial_year between 2007 - 1 and 2007
    and financial_month in ('4',' 12')
    and division_code = 11
    order by financial_month
    I know this will not fetch from the date the user parameter enters however is there any other options. Please help me out morgan...

  • How to set runtime parameter for the entire system

    Hi,
    I have a problem with setting runtime parameters in jre v1.6.0_07. I have an XP computer with multiple users and to use the application eavery user must set the runtime parameter once by going to java control panel -> Java -> Java applet runtime settings -> view. How can i automate this? I have multiple users and there may be more users logging in so manually sending the C:\<userProfileDirectory>\Application Data\Sun\Java\Deployment\deployment.properties file to all profiles is not a solution. Same question here but no solution. Every user must get this parameter when they log in, they may be new users or existing users. The software I'm trying to use is browser based, we don't trigger an exe or something from local to run the software.
    In C:\<userProfileDirectory>\Application Data\Sun\Java\Deployment\deployment.properties file there is a line like this;
    deployment.javapi.jre.1.6.0_07.args=
    This works for a single user. I've read the instructions in [deployment guide|http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/properties.html] but the properties file we put in C:\WINDOWS\Sun\Java\Deployment does not support ".args=" command. Anyone encountered or have a solution for this problem?
    Thanks.

    Hi,
    got solution for this problem? I am also having the same problem.
    Thanks.

  • Setting date format for import

    I have a CSV file that has approx. 600 entries in it.  2 of these fields are dates in the format mm/dd/yyy and mm/dd/yy.  The problem is that the import function treats them as dd/mm/yyyy or dd/mm/yy. 
    Is there any way to tell the import routine what format the date fields are in?

    1. Straight from the documentation ([DROP TABLESPACE|http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_9004.htm|DROP TABLESPACE]):
    Oracle Database removes from the data dictionary all metadata about the
    tablespace and all datafiles and tempfiles in the tablespace. The
    database also automatically drops from the operating system any
    Oracle-managed datafiles and tempfiles in the tablespace. Other
    datafiles and tempfiles are not removed from the operating system
    unless you specify INCLUDING CONTENTS AND DATAFILES.
    HTH!

  • Date format for the RES.PdtePerKey parameter in FDM

    Hi
    I am using FDM 11.1.2.1 to load data from Oracle eBS 11.5 to Hyperion Planning 11.1.2.1.
    I have created a BefExportToDat event script using the parameter RES.PdtePerKey, which contains the period loaded.
    On the development environment, the script, using a to_date('dtePerKey','MM/DD/YYYY'), is ok, because the period variable is returning a date loke 'MM/DD/YYYY'.
    On the production environment, the same script is KO because the period variable is returning a date like 'DD/MM/YYYY'.
    Which configuration parameter could explain this difference?
    Thanks a lot for your help
    Fanny

    No, sorry, I have said a mistake!
    I had checked the admin user regional settings.
    You were right : the regional settings of the DCOM FDM user were different between the 2 servers (english for dev, french for prod).
    If I use "*English*" regional settings on my production server, that is ok, too!
    Thanks a lot!
    Fanny
    PS : but now, the batch loader which was ok with the French regional settings is now ko... but it is another problem... :-(

  • How to get the Date format inside the table

    I have a startdate column in the db in the format May 5, 2001 12:39:00 PM, when I query it from a view in this way : SELECT startdate, ... FROM ..., it returns the format in the db,
    However I have to do this SELECT
    decode(startdate, null, 'NOT START'), startdate), ... the result is 5-MAY-01,
    then I tried this to_char(startTime, 'Month DD, YYYY HH:MI: A.M.') the results become May 05, 2001 12:39:00 PM. (more space between month and day, and 05 instaed of 5)
    Does anybody know how to fix this, so I get exactly what is in the db?
    Thanks in advance

    No matter what you do if you are storing a date in a column it will get stored in the Oracle's internal 7 byte date format.
    The way you get it on retreiving it is as set by your date format. You can either change the default date format for the instance, the individual session or the individual SQL statement(in this case using to_char(date, 'format')).
    If you want to store the date in a format you want to store you'll have to store it as char or varchar2.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by George ([email protected]):
    I have a startdate column in the db in the format May 5, 2001 12:39:00 PM, when I query it from a view in this way : SELECT startdate, ... FROM ..., it returns the format in the db,
    However I have to do this SELECT
    decode(startdate, null, 'NOT START'), startdate), ... the result is 5-MAY-01,
    then I tried this to_char(startTime, 'Month DD, YYYY HH:MI: A.M.') the results become May 05, 2001 12:39:00 PM. (more space between month and day, and 05 instaed of 5)
    Does anybody know how to fix this, so I get exactly what is in the db?
    Thanks in advance<HR></BLOCKQUOTE>
    When you do to_char() with 'month' oracle blank pads the month to nine characters, the same goes with day too. So to get rid of it you'll have to trim() the month. And if you want to get a single digit for date less than 10 instead of 0x you'll have to do a bit of extra jugglery using translate() or replace().
    Hope this helps
    Naveen

  • Date Format for Language

    Hi all,
    is there any possibility to customize the default date format for the portal for the languages?
    When I set the user language to EN, date format for EN is default MM/dd/yyyy. I would like to have dd MMM yyyy (like 12 Aug 2005).
    Thanks in advance
    balop

    Hi peter,
             I thought you wanted to change the date format in the webdynpo implementation(coding).Now I got what you wanted ie date in ur reqd format from the picker UI itself.
             I really dont see much support in Webdynpro Date picker UI as of now for ur requirement.
            Anyway thanks for giving me a good question to think )
    Rdgs,
    G

  • Date format in the file datastore

    Hi,
    I have source as file, in which I have date column. While creating the file datastore, I have selected the datatype as date & have given the source date format in the format column and it is working fine.
    But I have source file coming with different date formats for the same column.
    My question is whether i can give multiple date formats in the format column??
    1. If yes how to separate the formats i.e with comma or semi-colon or etc...
    2. If No, thn how to achieve it. as I can use to_date function, but in that also I have to give all the date formats.

    Assuming Oracle is target database..
    Try this...
    1. In your file data store make the column as Varchar2
    2. In the interface mapping -- specify the following string in the target column mapping
    TO_DATE(REPLACE('2011-06-01','-',''),'YYYYMMDD')
    If your target column is date, Oracle will convert database proper format and insert the date..
    Hope this works out....
    Thanks
    Satish
    Edited by: user12826256 on 01-Jul-2011 02:15

  • Date formats for SQL statements used by recordset object

    Hi,
    Date formatting appears to be quite problematic for Business One.  I did a forum search for date issues and I don't think I saw any of them with an "answered" status.  I have an issue with formatting a date for the creation of an SQL statement that the DI sends to SQL Server 2005.  I need to format a date so that the localization parameters don't matter for either the client machine or SQL Server's machine.  We don't have a problem as long as our machines are localized as USA.
    I have PL 22 and I have a form - ours - where I use the Today() function to fill a date field.  So this is a date that is not entered by the user.  The result of this function is consistent with the localization parameters on my machine.  We have two other date fields on the form where the user must type in the date. 
    As a test, I changed my machine to the UK parameters.  I then set up the language parameters of Business One for English(United Kingdom).  I changed the date format specifications in Business One so that its format is dd/mm/yy.  I then brought up the form and the field that is formatted by the above function arrived in the form's field as dd/mm/yy.  I then typed in the two other dates in the same format and added the record to the database.  The form's table is user-defined. 
    I dismissed the form then brought it back up loaded with the new record.  The date that was entered by the function appeared in USA format (mm/dd/yy).  The dates that were typed in appeared in the Business One format (dd/mm/yy).  This of course is not consistent.
    When I looked at what got into the database, the formats were the opposite.  Weird!  To make matters really confusing, I run an SQL statement within SQL Server Mgt Studio, and use the WHERE clause to filter on the date that was based on the function.  It didn’t matter what format I used for the WHERE clause, the record came up.  Does anyone have any idea about how I can ensure that I always use the correct date format for SQL statements passed by Business One to SQL Server regardless of where in the world the application is being run?
    Thanks,
    Mike

    Ian,
    Here's what I'm concerned about:  I’m using the date in a “WHERE” clause.
    Assume the date is Aug 3, 2007.
    "SELECT * FROM Table WHERE StartDate > ‘8/3/2007’"
    OR
    "SELECT * FROM Table WHERE StartDate > ‘3/8/2007’"
    If the client machine is set up as USA, the today function will provide the date as formatted in the first query.  If the database server is setup as let’s say the UK, I believe that SQL Server query parser will interpret the date as Mar 8, 2007.
    If the client machine is set up as UK, the today function will provide the date as formatted in the second query.  If the database server is setup as let’s say USA, I believe that SQL Server query parser will also interpret the date as Mar 8, 2007.
    In both cases it would be wrong.
    I know I could use the DATEPART function to get the three parts and this will make the code indifferent to the localization specs of the client machine.  I need to then be able to concatenate those date parts for the “WHERE” clause so that the localization specifications of the database server don’t matter.
    Thanks,
    Mike

Maybe you are looking for