4 New T-SQL Functions: Listing 1.

Using TRY_CONVERT with the Style parameter.

select TRY_CONVERT(varchar(50), '08/18/2012', 1) as NewResult
NewResult
09/08/12

select TRY_CONVERT(varchar(50), '08/18/2012', 2) as NewResult
NewResult
12.09.08

select TRY_CONVERT(varchar(50), '08/18/2012', 3) as NewResult
NewResult
08/09/12

select TRY_CONVERT(varchar(50), '08/18/2012', 4) as NewResult
NewResult
08.09.12

select TRY_CONVERT(varchar(50), '08/18/2012', 5) as NewResult
NewResult
08-09-12

About the Author

Sam Nasr has been a software developer since 1995, focusing mostly on Microsoft technologies. Having achieved multiple certifications from Microsoft (MCAD, MCTS(MOSS), and MCT), Sam develops, teaches, and tours the country to present various topics in .Net Framework. He is also actively involved with the Cleveland C#/VB.Net User Group, where he has been the group leader since 2003. In addition, he also started the Cleveland WPF Users Group in June 2009, and the Cleveland .Net Study Group in August 2009, and is the INETA mentor for Ohio. When not coding, Sam loves spending time with his family and friends or volunteering at his local church. He can be reached by email at [email protected].

comments powered by Disqus

Featured

  • Visual Studio Insiders Further Refines Copilot Usage Tracking

    With devs reeling from usage-based billing sticker shock, Visual Studio 18.9 makes monthly Copilot plan usage easier to reach from the coding workflow while adding more cost information to a redesigned model picker.

  • VS Code 1.130 Expands Agent Host and Review Tools

    Microsoft's latest weekly VS Code release advances shared agent sessions, multi-file change review, chat visibility and terminal navigation

  • Microsoft Agent Framework Makeover: Claws, Loops and Harnesses

    Microsoft's newly released Agent Framework Harness packages the loops, planning, memory, context management and safety controls that developers previously had to assemble around AI models themselves.

  • Visual Studio 2026 Gives Copilot Built-In Skills -- and Makes Them Prove Their Worth

    Microsoft is moving Agent Skills beyond bring-your-own instructions by shipping expert-authored workflows with the IDE, while keeping them off by default until testing shows their benefits justify the additional token use.

Subscribe on YouTube