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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -