PrepAway - Latest Free Exam Questions & Answers

What should you implement?

Note: This question is part of a series of questions that use the same or similar answer choices. An
answer choice may be correct for more than one question in the series. Each question is independentof the other questions in this series. Information and details provided in a question apply only to that
question.
You have a table named AuditTrail that tracks modifications to data in other tables. The AuditTrail table is
updated by many processes. Data input into AuditTrail may contain improperly formatted date time values. You
implement a process that retrieves data from the various columns in AuditTrail, but sometimes the process
throws an error when it is unable to convert the data into valid date time values.
You need to convert the data into a valid date time value using the en-US format culture code. If the conversion
fails, a null value must be returned in the column output. The conversion process must not throw an error.
What should you implement?

PrepAway - Latest Free Exam Questions & Answers

A.
the COALESCE function

B.
a view

C.
a table-valued function

D.
the TRY_PARSE function

E.
a stored procedure

F.
the ISNULL function

G.
a scalar function

H.
the TRY_CONVERT function

Explanation:
A TRY_CONVERT function returns a value cast to the specified data type if the cast succeeds; otherwise,
returns null.
https://msdn.microsoft.com/en-us/library/hh230993.aspx

9 Comments on “What should you implement?

  1. eder says:

    the answer is the letter D.

    The following table shows the mappings from SQL Server languages to .NET Framework cultures.

    Full name Alias LCID Specific culture
    us_english English 1033 en-US

    SELECT TRY_PARSE(‘Jabberwokkie’ AS datetime2 USING ‘en-US’) AS Result;

    SELECT TRY_PARSE(’01/01/2011′ AS datetime2 USING ‘en-US’)AS Result

    FUENTE:MICROSOFT




    9



    0
    1. 113 says:

      LETTER D is the answer:
      requirement: You need to convert the data into a valid date time value using the en-US format culture code.
      TRY_PARSE ( string_value AS data_type [ USING culture code ] )
      SELECT TRY_PARSE(’01/01/2011′ AS datetime2 USING ‘en-US’)AS Result
      Result
      ————————
      2011-01-01 00:00:00.0000000

      SELECT TRY_CONVERT(datetime2, ’01/01/2011′,1033) AS Result –1033 is en-us code
      Result
      ————————
      NULL




      0



      0
      1. 113 says:

        1033 as style is not correct, US style is 101
        SELECT TRY_CONVERT(datetime2, ’01/01/2011′,101) AS Result
        Result
        ————————
        2011-01-01 00:00:00.0000000

        by the way the requirement is cultural code and not style




        1



        0

Leave a Reply