This is a multi-part message in MIME format.
--------------020901030109020800050702
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 2008-02-12 07:30, Ken Johanson wrote:
>>>> Sure, but you're a prime candidate for understanding the value of >> following the spec if you're trying to write software that works with >> multiple databases.>> The spec has diminished in this (CAST without length) context:> a) following it produces an output which has no usefulness whatsoever > (123 != 1)I *OFTEN* use a cast of CHAR to get just the first character.
> b) all the other databases chose to not follow the spec in the context > of cast and char with implicit length.I doubt that:
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db2.doc.sqlref/castsp.htmhttp://msdn2.microsoft.com/en-us/library/aa258242(SQL.80).aspx
Your specific example is covered here:
http://vista.intersystems.com/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_castand here:
http://answers.yahoo.com/question/index?qid=20071017084134AA4mCJC>> When the length is unqualified, a cast to char should one of:>> 1) failfast> 2) auto-size to char-count (de facto)> 3) pad to the max-lengthWhat is wrong with using VARCHAR for your
purpose???????????????????????????? If you want the string auto-sized,
that is what VARCHAR is for.
CHAR is, BY DEFINITION, a DECLARED fixed length.
--------------020901030109020800050702
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 2008-02-12 07:30, Ken Johanson wrote:
<blockquote cite="mid:47B1BB89.6000203@kensystem.com" type="cite">
<blockquote type="cite"><br>
Sure, but you're a prime candidate for understanding the value of
following
the spec if you're trying to write software that works with multiple
databases.
<br>
</blockquote>
<br>
The spec has diminished in this (CAST without length) context:
<br>
a) following it produces an output which has no usefulness whatsoever
(123 != 1)
<br>
</blockquote>
I <b>OFTEN</b> use a cast of CHAR to get just the first character.<br>
<br>
<blockquote cite="mid:47B1BB89.6000203@kensystem.com" type="cite">b)
all the other databases chose to not follow the spec in the context of
cast and char with implicit length.<br>
</blockquote>
<br>
I doubt that:<br>
<br>
<a class="moz-txt-link-freetext" href="
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db2.doc.sqlref/castsp.htm">
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db2.doc.sqlref/castsp.htm</a><br>
<a class="moz-txt-link-freetext" href="
http://msdn2.microsoft.com/en-us/library/aa258242(SQL.80).aspx">
http://msdn2.microsoft.com/en-us/library/aa258242(SQL.80).aspx</a><br>
<br>
Your specific example is covered here:<br>
<a class="moz-txt-link-freetext" href="
http://vista.intersystems.com/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_cast">
http://vista.intersystems.com/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_cast</a><br>
<br>
and here:<br>
<a class="moz-txt-link-freetext" href="
http://answers.yahoo.com/question/index?qid=20071017084134AA4mCJC">
http://answers.yahoo.com/question/index?qid=20071017084134AA4mCJC</a><br>
<br>
<blockquote cite="mid:47B1BB89.6000203@kensystem.com" type="cite"><br>
When the length is unqualified, a cast to char should one of:
<br>
<br>
1) failfast
<br>
2) auto-size to char-count (de facto)
<br>
3) pad to the max-length
<br>
</blockquote>
<br>
What is wrong with using VARCHAR for your
purpose???????????????????????????? If you want the string auto-sized,
that is what VARCHAR is for.<br>
<br>
CHAR is, BY DEFINITION, a DECLARED fixed length.<br>
<br>
<br>
</body>
</html>
--------------020901030109020800050702--