IT452 Unit 7 Programmable Objects

$ 20

IT452 Unit 7 Programmable Objects

1. Create a variable for the region column, birthdate column and empid column.

2. Create and use a variable to pull the category name for categoryID 8. Write a separate query to return the output.

3. Write an IF ELSE element that checks for the current month and prints ‘This Month is November’ if it is November or prints ‘This Month is not November’ if the month is not November.
Prints This Month is November if you enter 11

4. Write a WHILE Loop that returns ProductName, CategoryID and UnitPrice and compares the CategoryID to 4. As long as it is less than 4 it should print the product name, categoryid and unitprice.
12 rows for Category 1
12 rows for Category 2
13 rows for Category 3

5. Write a script that performs the following tasks:
a. Define a variable to hold the maximum database ID value.
b. Set that variable equal to the maximum database ID value.  To determine the maximum database ID value, use the database_id column of the sys.databases table in the master database.
c. Use PRINT to print the value of the variable. Result: [Note:  PRINT writes to the Messages tab of the query window.]
[Note:  Your result may vary.]

6. Create a cursor that updates only to and from the ProductName column of the Production.Products table and print that column out. Returns all of the productnames upon successful execution

7. Create a table variable called work table with the following structure. Insert the row of data listed and execute the batch.
Worktable
PK int Primary Key
Col1 int Not Null
Insert 1 row with the following data:
1, 101
Execute the batch
Returns 1 row

8. Create a global temporary table called GlobalTempWork with the following structure
GlobalTempWork
Test nvarchar primary key,
Col1 int
Insert 1 row with the following data
10
Execute the batch to return the 1 row

95 in stock

SKU: IT452UNIT7 Categories: ,

Description

IT452 Unit 7 Programmable Objects

1. Create a variable for the region column, birthdate column and empid column.

2. Create and use a variable to pull the category name for categoryID 8. Write a separate query to return the output.

3. Write an IF ELSE element that checks for the current month and prints ‘This Month is November’ if it is November or prints ‘This Month is not November’ if the month is not November.
Prints This Month is November if you enter 11

4. Write a WHILE Loop that returns ProductName, CategoryID and UnitPrice and compares the CategoryID to 4. As long as it is less than 4 it should print the product name, categoryid and unitprice.
12 rows for Category 1
12 rows for Category 2
13 rows for Category 3

5. Write a script that performs the following tasks:
a. Define a variable to hold the maximum database ID value.
b. Set that variable equal to the maximum database ID value.  To determine the maximum database ID value, use the database_id column of the sys.databases table in the master database.
c. Use PRINT to print the value of the variable. Result: [Note:  PRINT writes to the Messages tab of the query window.]
[Note:  Your result may vary.]

6. Create a cursor that updates only to and from the ProductName column of the Production.Products table and print that column out. Returns all of the productnames upon successful execution

7. Create a table variable called work table with the following structure. Insert the row of data listed and execute the batch.
Worktable
PK int Primary Key
Col1 int Not Null
Insert 1 row with the following data:
1, 101
Execute the batch
Returns 1 row

8. Create a global temporary table called GlobalTempWork with the following structure
GlobalTempWork
Test nvarchar primary key,
Col1 int
Insert 1 row with the following data
10
Execute the batch to return the 1 row

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.