Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9319341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:21:41+00:00 2026-06-19T03:21:41+00:00

I have an integer column Month I would like to get 2 digit number

  • 0

I have an integer column “Month”
I would like to get 2 digit number for month.

This is what I have tried: DATEPART(mm, @Date)

It returns one digit for months January to September
I am using SQL Server 2008

Anyone has suggestion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T03:21:43+00:00Added an answer on June 19, 2026 at 3:21 am

    there are different ways of doing it

    • Using RTRIM and specifing the range:

    like

    SELECT RIGHT('0' + RTRIM(MONTH('12-31-2012')), 2); 
    
    • Using Substring to just extract the month part after converting the date into text

    like

    SELECT SUBSTRING(CONVERT(nvarchar(6),getdate(), 112),5,2)
    

    see Fiddle

    There may be other ways to get this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with a column month ( integer ). In this column
I have an integer column which I would like to add a foreign key
I have a dataframe with a column of integers that I would like to
I have a 'created' column which is INTEGER and this is how I insert
I have 2 INTEGER columns like the following: Month Year ----- ----- 5 2011
I have column stsmm which is a month integer. I need it in the
Using OdbcDataReader in C#, I have a query that returns an integer column which
Suppose you have a DB table like this: Table t .... column_a integer column_b
I have table like this: CREATE TABLE Date_Table (Year DATETIME , Month1 INTEGER, Month2
I have an integer column in my table. It is product id and has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.