Your database stores telephone numbers. Each telephone number is stored as an integer. You must format the telephone number to print on a report in thefollowing format:(999) 999-9999You have selected the phone number into a local variable as follows:DECLARE @PhoneNumber int Which statement will correctly format the number?
A. SELECT 'Phone Number' = ‘(‘ + SUBSTRING(CONVERT(varchar(10),@PhoneNumber),3,0) + ‘)‘ + SUBSTRING(CONVERT(varchar(10), @PhoneNurnber),3,3)+‘-‘ + SUBSTRING(CONVERT(varchar(10), @PhoneNumber),4,6)
B. SELECT 'Phone Number' = ‘(‘ + SUBSTRING(CONVERT(varchar(10),@PhoneNuwber),3,1)+ ‘)‘ + SUBSTRING(CONVERT(varcher(10), @PhoneNumber),3,4)+ ‘-‘ +SUBSTRING(CONVERT(varchar(10), @PhoneMumber),4,7)
C. SELECT 'Phone Number' = ‘(‘ + SUBSTRING(CONVERT(varchar(10),@PhoneNumber),0,3) + ‘)‘ + SUBSTRING(CONVERT(varchar(10), @PhoneNumber),3,3)+‘-‘ + SUBSTRING(CONVERT(varchar(10), @PhoneNurtiber),6,4)
D. SELECT 'Phone Number' = ‘(‘ + SUBSTRING(CONVERT(varchar(10),@PhoneNumber),1,3) + ‘)‘ + SUBSTRING(CONVERT(varchar(10), @PhoneNumber),4,3)+'-' + SUBSTRING(CONVERT(varchar(10), @PhoneNumber),7,4)
You are a database developer for Wide World Importers. You are creating a database that will store order information. Orders will be entered in aclient/server application. Each time a new order is entered, a unique ordernumber must be assigned. Order numbers must be assigned in ascending order. Anaverage of 10,000 orders will be entered each day. You create a new table namedOrders and add an OrderNumber column to this table. What should you do next?
A. Set the data type of the column to UniqueIdentifier.
B. Set the data type of the column to int, and set the IDENTITYproperty for the column.
C. Set the data type of the column to int. Create a user-defined function that selects the maximum order number in the table.
D. Set the data type of the column to int. Create a NextKey table,and add a NextOrder column to the table. Set the data type of the NextOrdercolumn to int. Create a stored procedure to retrieve and update the value heldin the NextKey.
You are creating a script that will execute this stored procedure. Ifthe stored procedure executes successfully, it should report the year-to-datesales for the book title. If the stored procedure fails to execute, it shouldreport the following message:“No Sales Found”How should you create the script?
A. DECLARE @retval int DECLARE @ytd int EXEC get_sales_for_title ‘Net Etiquette’, @ytd IF @retval < 0 PRINT ‘No sales found’ ELSE PRINT ‘Year to date sales: ’ + STR (@ytd) GO
B. DECLARE @retval int DECLARE @ytd int EXEC get_sales_for_title ‘Net Etiquette’, @ytd OUTPUT IF @retval < 0 PRINT ‘No sales found’ ELSE PRINT ‘Year to date sales: ’ + STR (@ytd) GO
C. DECLARE @retval int DECLARE @ytd int EXEC get_sales_for_title ‘Net Etiquette’,@retvalOUTPUT IF @retval < 0 PRINT ‘No sales found’ ELSE PRINT ‘Year to date sales: ’ + STR (@ytd) GO
DECLARE @retval int DECLARE @ytd int EXEC @retval = get_sales_for_title ‘Net Etiquette’,@ytd OUTPUT IF @retval < 0 PRINT ‘No sales found’ ELSE PRINT ‘Year to date sales: ’ + STR (@ytd) GO