NOTE 216 Part I EXAM PREPARATION Where
Sunday, May 17th, 2009NOTE 216 Part I EXAM PREPARATION Where Data type is the data type you want to convert to Expression is the data being converted The following example converts the Price column into a CHAR data type so that you can concatenate it with another string expression. Remember, concatenation can only be done using strings, so it must be converted: SELECT The blog costs + CONVERT(CHAR(5),price) AS Price .of blog FROM titles Using the CAST Function The CAST function is similar to the CONVERT function in that it con- Character Formatting When data is verts data. It is preferred over the CONVERT function because it s converted to a char data type that will based on the SQL-92 standard. Of course, there is no harm in not adequately store the value, an using either, but I personally use this more frequently. The syntax asterisk (*) denotes the problem. for CAST is: However, when you convert to integer CAST(expression AS data type) or Unicode data, an error message appears. The example in Figure 4.4 Notice that the parameters are switched around in comparison to clarifies this point. the CONVERT function. CAST is usually preferred over CONVERT for operations with more advanced processing requirements. FIGURE 4.4 Data error clarification.
If you looking for unlimited one inclusive web hosting plan please check web hosting plan website.