Change a time stamp

Posted on 2011-10-18
Last Modified: 2012-05-12
My field in SQL comes up in theis format: 2011-10-17-

I need it in this format:10/17/2011 12:00:20:307000

I have tired this but nothing changes.
-- Code to get frm OPENQUERY into a CTE --

SELECT *, CONVERT(varchar(30),ptdatets,131) as chg FROM CTE

Open in new window

Question by:jaymz69
    1 Comment
    LVL 39

    Accepted Solution

    SQL Server displays the format of the datetime based on server and client settings.  It is actually stored as an 8 byte numeric value in the database.  

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
    In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    733 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

    20 Experts available now in Live!

    Get 1:1 Help Now