Edit C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\odbc\7.0.1\help\reference\flatfile.13.4.html
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <!-- MOTW-DISABLED saved from url=(0014)about:internet --> <title>Insert Statement</title> <link rel="StyleSheet" href="css/flatfile.css" type="text/css" media="all" /> <link rel="StyleSheet" href="css/webworks.css" type="text/css" media="all" /> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/context.js"></script> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/towwhdir.js"></script> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/wwhpagef.js"></script> <script type="text/javascript" language="JavaScript1.2"> <!-- var WebWorksRootPath = ""; // --> </script> <script type="text/javascript" language="JavaScript1.2"> <!-- // Set reference to top level help frame // var WWHFrame = WWHGetWWHFrame("", true); // --> </script> <script type="text/javascript" language="JavaScript1.2" src="scripts/expand.js"></script> </head> <body class="" style="background-color: #FFFFEE;" onload="WWHUpdate();" onunload="WWHUnload();" onkeydown="WWHHandleKeyDown((document.all||document.getElementById||document.layers)?event:null);" onkeypress="WWHHandleKeyPress((document.all||document.getElementById||document.layers)?event:null);" onkeyup="WWHHandleKeyUp((document.all||document.getElementById||document.layers)?event:null);"> <br /> <div class="WebWorks_Breadcrumbs" style="text-align: left;"> <a class="WebWorks_Breadcrumb_Link" href="flatfile.13.1.html#106938">11 SQL Statements for Flat-File Drivers</a> : Insert Statement</div> <hr align="left" /> <blockquote> <div class="head_1"><a name="106938">Insert Statement</a></div> <div class="Body"><a name="106939">The Insert statement is used to add new rows to a database table. With it, you can specify </a>either of the following options:</div> <div class="list_bulleted_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_inner"><a name="106940">A list of values to be inserted as a new record</a></div> </td> </tr> </table> </div> <div class="list_bulleted_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_inner"><a name="106941">A Select statement that copies data from another table to be inserted as a set of new </a>rows</div> </td> </tr> </table> </div> <div class="Body"><a name="106942">The form of the Insert statement is:</a></div> <div class="syntax_first"><a name="106943">INSERT INTO </a><span class="EquationVariables">table_name</span> [(<span class="EquationVariables">col_name</span>, ...)] </div> <div class="syntax"><a name="106944">{VALUES (</a><span class="EquationVariables">expr</span>, ...) | <span class="EquationVariables">select_statement</span>}</div> <div class="Body"><span class="EquationVariables"><a name="106945">table_name</a></span> can be a simple table name or a full path name. A table name is preferred for portability to other SQL data sources.</div> <div class="Body"><span class="EquationVariables"><a name="106946">col_name</a></span> is an optional list of column names giving the name and order of the columns whose values are specified in the Values clause. If you omit <span class="EquationVariables">col_name</span>, the value expressions (<span class="EquationVariables">expr</span>) must provide values for all columns defined in the file and must be in the same order that the columns are defined for the file.</div> <div class="Body"><span class="EquationVariables"><a name="106947">expr</a></span> is the list of expressions giving the values for the columns of the new record. Usually, the expressions are constant values for the columns. Character string values must be enclosed in single (â??) or double (") quotation marks, date values must be enclosed in braces {}, and logical values that are letters must be enclosed in periods (for example, .T. or .F.).</div> <div class="Body"><a name="106948">An example of an Insert statement that uses a list of expressions</a> is:</div> <div class="syntax_first"><a name="106949">INSERT INTO emp (last_name, first_name, emp_id, salary, hire_date)</a></div> <div class="syntax"><a name="106950">VALUES ('Smith', 'John', 'E22345', 27500, {4/6/1999})</a></div> <div class="Body"><a name="106951">Each Insert statement adds one record to the database table. In this case a record has </a>been added to the employee database table, emp. Values are specified for five columns. The remaining columns in the table are assigned a blank value, meaning NULL.</div> <div class="Body"><span class="EquationVariables"><a name="106952">select_statement</a></span> is a query that returns values for each <span class="EquationVariables">col_name</span> value specified in the column name list. Using a Select statement instead of a list of value expressions lets you select a set of rows from one table and insert it into another table using a single Insert statement.</div> <div class="Body"><a name="106953">An example of an Insert statement that uses a Select statement</a> is:</div> <div class="syntax_first"><a name="106954">INSERT INTO emp1 (first_name, last_name, emp_id, dept, salary)</a></div> <div class="syntax"><a name="106955">SELECT first_name, last_name, emp_id, dept, salary from emp</a></div> <div class="syntax"><a name="106956">WHERE dept = 'D050'</a></div> <div class="Body"><a name="106957">In this type of Insert statement, the number of columns to be inserted must match the </a>number of columns in the Select statement. The list of columns to be inserted must correspond to the columns in the Select statement just as it would to a list of value expressions in the other type of Insert statement. That is, the first column inserted corresponds to the first column selected; the second inserted to the second, and so forth.</div> <div class="Body"><a name="106958">The size and data type of these corresponding columns must be compatible. Each column </a>in the Select list should have a data type that the driver accepts on a regular Insert/Update of the corresponding column in the Insert list. Values are truncated when the size of the value in the Select list column is greater than the size of the corresponding Insert list column.</div> <div class="Body"><a name="106959">The Select statement is evaluated before any values are inserted. This query cannot be </a>made on the table into which values are inserted.</div> <script type="text/javascript" language="JavaScript1.2"> <!-- // Clear related topics // WWHClearRelatedTopics(); document.writeln(WWHRelatedTopicsInlineHTML()); // --> </script> </blockquote> <script type="text/javascript" language="JavaScript1.2"> <!-- document.write(WWHRelatedTopicsDivTag() + WWHPopupDivTag() + WWHALinksDivTag()); // --> </script> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de