17.07.2015 Views

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix A – Views and Functions Reference• Expression: This is the value in which a portion will be returned.The data type can be any type that can be implicitly converted tovarchar or nvarchar data types.• Characters_To_Return: This is the number of characters that areto be returned.The SUBSTRING system function returns a portion of the value passed, basedupon a defined number of characters from a defined beginning position withinthe value. The value returned can be varchar, nvarchar, or varbinary, dependingupon the data type of the value passed into the system function.The arguments for the SUBSTRING system function are:• Expression: This is the value in which a portion will be returned.The data type can be any type that can be implicitly converted tovarchar or nvarchar data types.• Start_Position: This is a number that represents the positionwithin the expression that will define the starting point of the value tobe returned.• Characters_To_Return: This is the number of characters that areto be returned.--Returns "This"SELECT LEFT('This is a string',4);GO--Returns "ring"SELECT RIGHT('This is a string',4);GO--Returns "a st"SELECT SUBSTRING('This is a string',9,4);GOListing A-29: LEFT, RIGHT, and SUBSTRING functions.REPLACEThe REPLACE system function provides the functionality of replacing alloccurrences of a given value with another value. This system function isvaluable for masking processes. If the value that is passed into this systemfunction is an nvarchar data type, the value returned will be nvarchar;otherwise this will return a varchar data type.The arguments for the REPLACE system function are:223

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!