required concatenated string of month and day with trailing zeros in Azure SQL

Tangirala DineshReddy 21 Reputation points
2021-06-07T13:19:33.257+00:00

I connect to Azure SQL database form Local SSMS.

103071-image.png

please find the below points.

  1. I have a table(CL_ClientEmployee) with column Birthon(datatype is datatype) in Azure SQL
    1. when I run the below query, data is coming wrong Why?

102975-image.png

  1. I required the below outputfor the given input values in Birthon Column of CL_ClientEmployee table. Could you please give me the query?

ExampleA)
input
1900-01-01(value in BirthOn column)
output
01/01
(Month/Date)

ExampleB)
input
1900-12-01(value in BirthOn column)
output
12/01
(Month/Date)

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Morillo 33,611 Reputation points MVP
    2021-07-06T22:48:27.28+00:00

    Please try the following:

    SELECT CONVERT(VARCHAR(5), BirthOn,101) AS [MM/DD]
    FROM CL_ClientEmployee

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.