I need to get the file size in bytes for any given file name inside a stored procedure, without using master..xp_filesize. Can somebody please help me on this.
The path and the file name is known to me.
I cannot use xp_filesize because the i cannot make use of xpFileUtil.dll file into the sql server version which I am using. this is the restriction which has been put on me for the development. The reason which i can think of is that you need to pay some $ to access that dll.
This is the only reason which i can think of for restriction of the using xpFileUtil.dll.
so now can you please help me for the same.
Ok, thanks... isn't that the way? Company buys something and that won't let you use it which forces you to revert to undocumented features in SQL Server...
This will work in SQL Server 2000 and SQL Server 2005 and you don't need SA privs to use it... Master.dbo.xp_GetFileDetails comes with SQL Server...
EXEC Master.dbo.xp_GetFileDetails 'pathandfilenamehere'
EXEC Master.dbo.xp_GetFileDetails 'uncpathandfilenamehere'
Did you try it or what?
That's running for local files only.
When you try using UNC Path, access is denied or the authentication failed.