Extracting data from the Synergetic database
Extracting data from the Synergetic database
Extracting data from the Synergetic database
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Advanced Microsoft Query and SQL examples<br />
<strong>Extracting</strong> <strong>data</strong> <strong>from</strong> <strong>the</strong> <strong>Synergetic</strong> <strong>data</strong>base<br />
The following example shows you how to display <strong>the</strong> third and fourth characters of <strong>the</strong> string constant<br />
abcdef. The result set is cd.<br />
SELECT x = SUBSTRING('abcdef', 3, 2)<br />
Substring function<br />
Returns part of a character, binary, text or image expression.<br />
Syntax<br />
SUBSTRING(expression, start, length)<br />
Arguments<br />
• expression is a character string, binary string, text, image, a column, or an expression that<br />
includes a column. Do not use expressions that include aggregate functions.<br />
• start is an integer that specifies where <strong>the</strong> substring begins.<br />
• length is an integer that specifies <strong>the</strong> length of <strong>the</strong> substring (<strong>the</strong> number of characters to<br />
return).<br />
Return types<br />
Returns character <strong>data</strong> if expression is one of <strong>the</strong> supported character <strong>data</strong> types. Returns binary <strong>data</strong><br />
if expression is one of <strong>the</strong> supported binary <strong>data</strong> types.<br />
The returned string is <strong>the</strong> same type as <strong>the</strong> given expression with <strong>the</strong> exceptions shown in <strong>the</strong> table.<br />
Given expression<br />
text<br />
image<br />
ntext<br />
Return type<br />
varchar<br />
varbinary<br />
nvarchar<br />
Remarks<br />
Offsets (start and length) using <strong>the</strong> ntext, char, or varchar <strong>data</strong> types must be specified in number of<br />
characters. Offsets using <strong>the</strong> text, image, binary, or varbinary <strong>data</strong> types must be specified in number<br />
of bytes.<br />
Note: Compatibility levels can affect return values.<br />
Version 60 Page 6-65