About 731,000 results
Open links in new tab
  1. sql server - SQL: how to specify a date format on creating a table

    Nov 8, 2017 · So I read there are different formats for a date in SQL (by the way I use Visual Studio and SQL Server). I tried this code: CREATE TABLE APP( ID INT NOT NULL, DT DATE FORMAT 'dd.mm.yyyy', ADDRESS NVARCHAR (100) , PRIMARY KEY (ID) );

  2. How can I get a MMYYYY format in SQL Server? - Stack Overflow

    Jan 7, 2014 · RIGHT(CONVERT(VARCHAR(10), TransactionDte, 103), 7) AS [MM/YYYY] If you want it without the / then use this: REPLACE(RIGHT(CONVERT(VARCHAR(10), TransactionDte, 103), 7),'/','') AS [MMYYYY]

  3. Create Table column date format dd-mm-yyyy SQL Server

    Nov 23, 2013 · Your best bet will be to store the date (if you are using SQL 2008, you should use the DATE datatype) in the universal format of yyyymmdd in the database and then use CONVERT(Date,YourColumn,105) when reading the data, to get it in the format you desire.

  4. How to Specify a Date Format on Creating a Table and

    Dec 18, 2024 · Let’s create another table called GFG_Intern to demonstrate the use of TO_DATE(). Format of date can be of different types such as: ‘dd-mm-yyyy’, ‘yyyy-mm-dd’, ‘mm-dd-yyyy’. CREATE TABLE GFG_Intern (e_name VARCHAR(20), e_id NUMBER, joiningDate DATE); INSERT INTO GFG_Intern VALUES ('FirstIntern', 1, TO_DATE('2022-12-12', 'yyyy-mm ...

  5. SQL Date Format Examples using CONVERT Function

    Dec 30, 2022 · To change the format of the date, you convert the requested date to a string and specify the format number corresponding to the format needed. Review the table for a list of SQL date formats with example output. The date parameter used for all of these examples is “2022-12-30 00:38:54.840”.

  6. Format SQL Server Dates with FORMAT Function

    Dec 17, 2024 · To get DD/MM/YYYY use SELECT FORMAT (getdate(), ‘dd/MM/yyyy ‘) as date; To get MM-DD-YY use SELECT FORMAT (getdate(), ‘MM-dd-yy’) as date; Check out more examples below; The syntax of the SQL Server FORMAT function is the following:

  7. Converting date format in sqlserver - Microsoft Q&A

    Nov 14, 2023 · If you want to show dd/mm/yyyy, use the Format method or Convert / Cast on the Date field to change the format. It is not suggested to store date in a particular varchar format. For example, what date was 11-6-2023? Was it the 6th of November 2023 or the 11th of June 2023?

  8. Specify Date Format on Creating a Table in SQL - Online …

    To display dates in a specific format, you can use the TO_CHAR () function in Oracle or FORMAT function in SQL Server. You may need to extract specific parts of a date, such as the year or month. Learn how to specify a date format when creating a …

  9. Convert SQL Server Date to mm-yyyy - Stack Overflow

    Mar 4, 2015 · You can use FORMAT function, available from SQL Server 2012 onwards: DECLARE @myDate DATETIME = '2012-04-20 05:54:59' SELECT FORMAT(@myDate, 'MM-yyyy') Output: 04-2012

  10. SQL Server Date Format Example - DatabaseFAQs.com

    Feb 24, 2025 · In this SQL Server tutorial, we will learn and understand how to use the SQL Server FORMAT function with the LIKE condition which will help to format the date as mm/dd/yyyy from the table by the query. And which will be explained with the help of an illustrated example.

Refresh