Skip navigation

T-SQL Tutor Project - 01 Oct 2002

Download the Code iconHere's a small homework assignment to help you continue to improve your ability to write scalar UDFs.

You can find the answers online in the UserDefinedFunctionsPartIIHomework.sql script file using the "Download the Code" link. Applying the tools and tips I gave you in this column, create and populate your sample table as Listing A shows.

First, write a function to handle the odd character strings that you use to store the separate date and time values. Next, assemble the strings as a date. Then, write a query to display the data in various styles. (Note the similarity of these values to the input of datetime data.)

Try to make your function flexible by allowing style as a parameter.

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish