The meaning of FILENAME in SQL
In SQL, the FILENAME function returns a string of file path and file name.
Syntax:
<code class="sql">FILENAME(<file_expression>)</code>
Where:
<file_expression> is a return file path and file name expression. Use Case:
The FILENAME function can be used to:
Example:
<code class="sql">-- 获取文件的完整路径和文件名
SELECT FILENAME('my_file.txt');
-- 检查文件是否存在
SELECT CASE WHEN FILENAME('my_file.txt') IS NOT NULL THEN 'File exists' ELSE 'File does not exist' END;
-- 将文件内容加载到表中
CREATE TABLE my_table AS
SELECT *
FROM OPENROWSET(BULK 'my_file.csv', FORMAT = 'CSV');</code>Note:
The above is the detailed content of What does FILENAME mean in sql. For more information, please follow other related articles on the PHP Chinese website!
Is FIL worth holding for the long term?
linux file rename command
What are the java text editors
Solution to insufficient cloud storage space
okex official website
What are the operators in Go language?
What are the new features of Hongmeng 3.0?
Cost-effectiveness analysis of learning python and c++