PrepAway - Latest Free Exam Questions & Answers

You use Microsoft SQL Server 2012 to develop a database application.

You use Microsoft SQL Server 2012 to develop a database application.

You

create a stored procedure named DeleteJobCandidate.

You need to ensure that if DeleteJobCandidate encounters an error, the execution of the stored procedure reports the error number.

Which Transact-SQL statement should you use?

A.

DECLARE @ErrorVar INT

;

DECLARE @RowCountVar INT;

EXEC DeleteJobCandidate

SELECT @ErrorVar = @@ERROR,

@RowCountVar = @@ROWCOUNT;

IF (@ErrorVar <> 0)

PRINT NError = + CAST(@@ErrorVar AS NVARCHAR(8)) + N,

Rows Deleted = + CAST(@RowCountVar AS NVARCHAR(8));

GO

B.

DECLARE @ErrorVar INT;

DECLARE @RowCountVar INT;

EXEC DeleteJobCandidate

SELECT @ErrorVar = ERROR_STATE(),

@RowCountVar = @@ROWCOUNT;

IF (@ErrorVar <> 0)

PRINT NError = + CAST(ERROR_STATE() AS NVARCHAR(8)) + N,

Rows Deleted

= + CAST(@RowCountVar AS NVARCHAR(8));

GO

C.

EXEC DeleteJobCandidate

IF (ERROR_STATE() != 0)

PRINT NError = + CAST(@@ERROR AS NVARCHAR(8)) + N,

Rows Deleted = + CAST(@@ROWCOUNT AS NVARCHAR(8));

GO

D.

EXEC

DeleteJobCandidate

PRINT N

Error = + CAST(@@ERROR AS NVARCHAR(8)) + N,

Rows Deleted = + CAST(@@ROWCOUNT AS NVARCHAR(8));

GO

Reference: http://msdn.microsoft.com/en-us/library/ms190193.aspx

Reference: http://msdn.microsoft.com/en-us/library/ms188790.aspx


Leave a Reply

PrepAway - Latest Free Exam Questions & Answers

You use Microsoft SQL Server 2012 to develop a database application.

You use Microsoft SQL Server 2012 to develop a database application.

Your application sends data to an NVARCHAR(MAX) variable named @var.

You need to write a Transact-SQL statement that will find out the success of a cast to a decimal (36,9).

Which code segment should you use?

A. B

EGIN TRY

SELECT

convert

(decimal(36,9), @var) as Value,

True As BadCast

END TRY

BEGIN CATCH

SELECT

convert (decimal(36,9), @var) as Value,

False As BadCast

END CATCH

B.

TRY(

SELECT convert (decimal(36,9), @var)

SELECT True As BadCast

)

CATCH(

SELECT False As BadCast

)

C.

SELECT

CASE

WHEN convert (decimal(36,9), @var) IS NULL

THEN True

ELSE False

END

AS BadCast

D.

SELECT

IIF(TRY_PARSE(@var AS decimal(36,9)) IS NULL,

True,

False

)

AS BadCast

Explanation:

Reference: http://msdn.microsoft.com/en-us/library/hh213126.aspx


Leave a Reply

PrepAway - Latest Free Exam Questions & Answers

You use Microsoft SQL Server 2012 to develop a database application.

You use Microsoft SQL Server 2012 to develop a database application.

You need to create an object that meets the following requirements:

Takes an input variable

Returns a table of

values

Cannot be referenced within a view

Which object should you use?

A. Scalar-valued function

B. Inline function

C. User-defined data type

D. Stored procedure

Explanation:


Leave a Reply