September 20, 2010 at 2:27 pm
Nevermind;
I figured out how to get rid of the trailing spaces within my batch file...
Hi Jeff,
That works great. The only problem I'm having with this is that the results seem to have a lot of trailing spaces in it.
I tried to edit the following portion of your query but they are still showing up:
SELECT rtrim(FileName) FROM #FileList WHERE Extension = '.txt' AND IsFile = 1
EXCEPT
SELECT rtrim(FileName) FROM #FileList WHERE Extension = '.pdf' AND IsFile = 1
I'm sending the results of this to a text file that is referenced in a batch file to trigger a conversion and the trailing spaces are killing it.
Also how difficult would it be to add the .txt extension back to the filename after checking. I tried to add Extension back in to the select but it says it needs to be in both. When adding it to both it obviously breaks the check from happening.
September 30, 2010 at 11:02 pm
brianparow (9/20/2010)
Nevermind;I figured out how to get rid of the trailing spaces within my batch file...
Hi Jeff,
That works great. The only problem I'm having with this is that the results seem to have a lot of trailing spaces in it.
I tried to edit the following portion of your query but they are still showing up:
SELECT rtrim(FileName) FROM #FileList WHERE Extension = '.txt' AND IsFile = 1
EXCEPT
SELECT rtrim(FileName) FROM #FileList WHERE Extension = '.pdf' AND IsFile = 1
I'm sending the results of this to a text file that is referenced in a batch file to trigger a conversion and the trailing spaces are killing it.
Also how difficult would it be to add the .txt extension back to the filename after checking. I tried to add Extension back in to the select but it says it needs to be in both. When adding it to both it obviously breaks the check from happening.
Use the FullFileName in the SELECT list. It has filename and extension. Leave the WHERE clause as it is.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 17, 2013 at 2:21 pm
Great procedure, thank you.
If I run it on the local drive it works great.
----------
USE [master]
GO
DECLARE@return_value int
EXEC@return_value = [dbo].[GetDirDetails]
@piFullPath = N'C:\'
SELECT'Return Value' = @return_value
GO
----------
However if try to run it on a network drive no records are returned
----------
USE [master]
GO
DECLARE@return_value int
EXEC@return_value = [dbo].[GetDirDetails]
@piFullPath = N'\\ELK\Share\Dealers\'
SELECT'Return Value' = @return_value
GO
-----------
I do have security rights to read on the network drive and can browse it from the same box SQL is running on. I'm at a loss. Am I missing something here?
May 17, 2013 at 4:20 pm
erouse (5/17/2013)
Great procedure, thank you.If I run it on the local drive it works great.
----------
USE [master]
GO
DECLARE@return_value int
EXEC@return_value = [dbo].[GetDirDetails]
@piFullPath = N'C:\'
SELECT'Return Value' = @return_value
GO
----------
However if try to run it on a network drive no records are returned
----------
USE [master]
GO
DECLARE@return_value int
EXEC@return_value = [dbo].[GetDirDetails]
@piFullPath = N'\\ELK\Share\Dealers\'
SELECT'Return Value' = @return_value
GO
-----------
I do have security rights to read on the network drive and can browse it from the same box SQL is running on. I'm at a loss. Am I missing something here?
I just tried the code at work using a UNC and it worked fine. The only way that nothing will be returned is if the path doesn't exist, there are no files in the path, or the system doesn't have the privs to the path. To be sure, it's what the system can see... not what you can see.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 31 through 33 (of 33 total)
You must be logged in to reply to this topic. Login to reply