sql server, sql command to convert date to yyyymmdd format

I had this command;
"CONVERT(VARCHAR,issdate,112) issdate, "
I thought this was converting the date (in date format) to character type yyyymmdd, but I just noticed the date format is back again.

Is the above right command to convert date to yyyymmdd?  I am using vb.net with sql server 2003
Who is Participating?
pdd1lanConnect With a Mentor Commented:
try it:
CONVERT(CHAR(8), issdate, 112)
mayankagarwalConnect With a Mentor Commented:
check this link to create a function to accomplish the same task
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Since your original convert function was almost correct (varchar versus char - doesn't make a big difference), I assume your application is still reading that as a date, and hence doing conversion again, and all the convert does for you then is to cut off the time portion.

BTW, you won't use MSSQL 2003 ;-).
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
In which way did those comments help?
CPOINT2000Author Commented:
Sorry, I am fairly new to EE, and just trying to figure out EE as well.  In case of my question, it was silly really.  I was in mid's of about dozen deadlines (who isn't), and somehow I had inadvertently changed my code, which was cutting off the 112 from the command.  Although I had displayed 112 in the original question, it was not in my functional program (at run time).   I accepted the solution from pdd1lan because that kind a woke me up.

CPOINT2000Author Commented:
Thanks for clarification, understood.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.