Which Transact-SQL statement should you use?

You are a database developer for your organization. You create an application that uses a Transact-SQL variable to store user input data. The database collation is case-insensitive. The variable is constructed as shown in the following statement:
DECLARE @content varchar(64)
SELECT @content = ‘The Advanced Research Projects Agency Network (ARPANET), was the worlds first operational packet switching network and the core network of a set that came to compose the global Internet.’
You need to implement a keyword search that meets the following requirements:
•Searches for the existence of the word ARPANET within the user-entered content.
•If the search term is found, the statement must return its starting position, and 0 otherwise.
•Performs a case-sensitive search for the given search term.
Which Transact-SQL statement should you use?
A. SELECT CHARINDEX(UPPER’arpanet’, @content, 1)
GO
B. SELECT CHARINDEX(‘ARPANET’, @content COLLATE Latin1_General_CS_AS)
GO
C. SELECT CHARINDEX(‘arpanet’, @content)
GO
D. SELECT CHARINDEX(‘ARPANET’, @content, COLLATE Latin1_General_CS_AS)
GO
E. SELECT CHARINDEX(@content, ‘ARPANET’, COLLATE Latin1_General_CS_AS)
GO
F. SELECT CHARINDEX(‘ARPANET’, @content COLLATE Latin1_General_CS_AS, 0)
GO
G. SELECT CHARINDEX(@content COLLATE Latin1_General_CS_AS, ‘ARPANET’, 0)
GO
H. SELECT CHARINDEX(@content, ‘ARPANET’)
GO

microsoft-exams

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.