338 Part I EXAM PREPARATION How does that
338 Part I EXAM PREPARATION How does that work? T-SQL, and most programming languages, use what s called the standard order of operations, which is as follows: Any operations in parenthesis are done first, from the innermost set of parenthesis working outward. Then, any functions are evaluated. After that, multiplication and division are carried out, then addition and subtraction. So, to get a different result for the preceding expression, add parentheses: SET @value = (2 + 3) * 4 This sets the variable @value to 20. Similar to the way a DECLARE statement works, you can create state ments like this by delimiting the values in the SELECT: DECLARE @id int, @name varchar(30) SELECT @id = id, @name = name FROM sysobjects WHERE .sysstat = 113 You should note three things here. First, both variables do get populated. Second, that result set contains multiple values (several records in sysobjects have a sysstat of 113). Which record puts values into the variables? It s non-deterministic. In other words, the values come out of one of the records, but there s no way to predict which record. So, writing code like that is probably a bad idea. Finally, the SELECT statement can do this multiple-assignment-in-one-statement trick, but the SET statement cannot. Now, you ve been setting these variables everywhere, but how do you know what s in them? There are two ways to display the contents of a variable. First, you can use the print statement, like this: DECLARE @id int, @name varchar(30) SELECT @id = id, @name = name FROM sysobjects WHERE .sysstat = 113 PRINT @id PRINT @name Or, you can do this: DECLARE @id int, @name varchar(30) SELECT @id = id, @name = name FROM sysobjects WHERE .sysstat = 113 SELECT @id, @name
If you looking for unlimited one inclusive web hosting plan please check cheap web hosting website.