sql server - How to get file create date in SQL? -


using openrowset, loading xml file temp table.

how file created date?

create table #t  (     intcol int,     xmlcol xml );  insert #t (xmlcol)     select *     openrowset(bulk 'c:\test.xml', single_blob) x;  select * #t 

t-sql not language can access file systems. can write stored procedure in c# accomplish task. read metadata appropriate classes in .net framework. can write custom function clr integration every information need filesystem.

here little working sample file created date clr integration in c#:

public class userdefinedfunctions {     [sqlfunction]     public static sqldatetime getcreateddate(sqlstring filepath)     {         return filepath.isnull ? sqldatetime.null : file.getcreationtime(filepath.value);     } } 

then you've got deploy assembly , register sql server, create proper function create function commands.

see more in codeproject sample


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -