Thursday, 1 September 2016

How to get list of all Folder in network sharing path using SQL Server.

   IF OBJECT_ID('tempdb..#TempTableName') IS NOT NULL
    DROP TABLE #TempTableName ;

   CREATE TABLE #TempTableName
    (
      id INT IDENTITY(1, 1) ,
      subdirectory NVARCHAR(512) ,
      depth INT
    ) ;

   INSERT   #TempTableName
            ( subdirectory
                       
            )
            EXEC MASTER.dbo.xp_cmdshell 'dir DriveName:\  /b /o:n /ad'
   IF NOT EXISTS ( SELECT   1
                   FROM     #TempTableName )
    BEGIN
        EXEC XP_CMDSHELL 'net use DriveName: \\ServerName\DriveName /user:domain\USERNAME PASSWORD'---code for Mapping drive in local Pc
    END

    

No comments:

Post a Comment

Row based styling for Primeng DataTable using Angualr 2,4

------------------------------------Component.Html---------------- < p -dataTable id = "Tbl" [ rowStyleClass ]= " Fu...