exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 71 discussion

Actual exam question from Microsoft's 70-761
Question #: 71
Topic #: 1
[All 70-761 Questions]

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 independent of the other questions in this series. Information and details provided in a question apply only to that question.
Multiple processes use the data from a table named Sales and place it in other databases across the organization. Some of the processes are not completely aware of the data types in the Sales table. This leads to data type conversion errors.
You need to implement a method that returns a NULL value id data conversion fails instead of throwing 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
Show Suggested Answer Hide Answer
Suggested Answer: H 🗳️
TRY_CONVERT returns a value cast to the specified data type if the cast succeeds; otherwise, returns null.
References:
https://docs.microsoft.com/en-us/sql/t-sql/functions/try-convert-transact-sql

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Joce_IT
Highly Voted 5 years, 7 months ago
Answer D with the TRY_PARSE function could not fit in this question. For example at page https://docs.microsoft.com/en-us/sql/t-sql/functions/try-parse-transact-sql?view=sql-server-ver15, we can read: "Use TRY_PARSE only for converting from string to date/time and number types." As the data types are not always known, the only possible answer is the one with the TRY_CONVERT function, which is H.
upvoted 15 times
tz_123
5 years ago
Great explanation, thanks!
upvoted 3 times
...
...
geekeek1
Most Recent 4 years, 5 months ago
use TRY_CONVERT() for general data types
upvoted 1 times
...
stm22
4 years, 11 months ago
remember the stated problem: "This leads to data type conversion errors". CONVERSION errors solved by TRY_CONVERT
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...