The FILENAME function returns the full path and name of the file system. It can be used with the following syntax: SELECT FILENAME(<file_name>). This function allows you to access data stored in the file system by specifying the file path in OPEN and EXECUTE statements.
How to use FILENAME in SQL
The FILENAME function returns the full path and name of the file name. It is used to access data stored in the file system, typically used with the OPEN and EXECUTE statements.
Syntax
<code>SELECT FILENAME(<file_name>)</code>
Where:
<file_name>
is the file to which the full path and name are to be returned name. Example
The following example shows how to use the FILENAME function to get the full path to a file named "my_file.txt" in the current database directory:
<code>SELECT FILENAME('my_file.txt');</code>
This will return results similar to:
<code>C:\my_database\my_file.txt</code>
Uses
The FILENAME function is useful in the following situations:
Note
The above is the detailed content of How to use filename in sql. For more information, please follow other related articles on the PHP Chinese website!