Solved

What is the best way to convert a  sql statement from one format to another? What function should i use?

Posted on 2014-10-08
5
93 Views
Last Modified: 2014-10-23
What is the best way to convert a  sql statement from one format to another? What function should i use?
0
Comment
Question by:vbnetcoder
  • 2
  • 2
5 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40368587
Depends.  Define 'one format' and 'another'.
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
ID: 40368605
Convert a SQL statement? Or do you mean convert data from a column?
0
 

Author Comment

by:vbnetcoder
ID: 40368634
I have a date in my database as one format and want it to display in another

MM/DD/YY

TO

YYYY/MM
0
 
LVL 45

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40368646
You can use the CONVERT function.
SELECT CONVERT(VARCHAR(12),ColNameHere,111) --> Returns yyyy/mm/dd
SELECT CONVERT(VARCHAR(7),ColNameHere,111) --> Returns yyyy/mm

Open in new window

0
 

Author Closing Comment

by:vbnetcoder
ID: 40399180
ty
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now