Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert a given year into number format

Status
Not open for further replies.

teddysnow12

Programmer
Aug 12, 2011
30
US
Hi,

I have a year field like rptg_yyyymm.
I need to convert it into number format in SQL.
Can anyone give me the syntax for this in SQL.
the number should like this,
for example if the year is 2008-10
it should look like 200810



Thanks!
 
TeddySnow,

Google returned the following when searching for "Formatting A Date in SQL": [URL unfurl="true"]http://weblogs.sqlteam.com/...[/url]

Hope this helps!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
I have a year field like rptg_yyyymm
If anything, a programmer ought to be precise. It is the nature of our profession.

So do you have a DATE field, formatted to display yyyy-mm or do you have a STRING field, structured as yyyy-mm? BIG difference!


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thank you guys for your valuable answers.
helped me a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top