User`s guide
Selecting Data Using the exec Function
6-41
• A cursor stays open until you close it using the close function.
Working with Microsoft Excel
For Microsoft Excel, tables in sqlquery are Excel worksheets. By default, some
worksheet names include $. To select data from a worksheet with this name format, use
an SQL statement of the form select * from "Sheet1$" (or 'Sheet1$') .
Database Considerations
• The order of records in your database is not constant. Use values in column names to
identify records. Use the SQL ORDER BY command to sort records.
• Before you modify database tables, ensure that the database is not open for editing. If
you try to edit the database while it is open, you receive this MATLAB error:
[Vendor][ODBC Driver] The database engine could not lock
table 'TableName' because it is already in use by
another person or process.
• You might experience issues with text field formats in the Microsoft SQL Server
database management system. Workarounds for these issues are as follows:
• Convert fields of format NVARCHAR, TEXT, NTEXT, and VARCHAR to CHAR in the
database.
• Use sqlquery to convert data to VARCHAR. For example, run a sqlquery
statement of the form 'select convert(varchar(20),field1) from
table1'.
• The PostgreSQL database management system supports multidimensional fields, but
SQL select statements fail when retrieving these fields unless you specify an index.
• Some databases require that you include a symbol, such as #, before and after a date
in a query as follows:
curs = exec(conn,'select * from mydb where mydate > #03/05/2005#')
• Some databases require that you include a symbol, such as #, before and after a date
in a query as follows:
curs = exec(conn,'select * from mydb where mydate > #03/05/2005#')
See Also
close | database | exec | resultset | rsmd | runstoredprocedure