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?

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
H is correct
5
23
agree
1
15
D
16
2
D is correct (SELECT TRY_PARSE(’01/01/2018′ AS DATE USING ‘en-US’)). You can’t pass culture code to TRY_CONVERT.
47
1
I Agree
5
1
D. the TRY_PARSE function
Use TRY_PARSE only for converting from string to date/time and number types. For general type conversions, continue to use CAST or CONVERT. Keep in mind that there is a certain performance overhead in parsing the string value.
https://docs.microsoft.com/en-us/sql/t-sql/functions/try-parse-transact-sql?view=sql-server-2017
5
0
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
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
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