DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
SITE SEARCH SQLUSA.com HEADLINES NEWS
SQL E/BOOKS   SQL 2014 PROGRAMMING   DOWNLOADS
SCRIPTS SQL 2005 SQL 2008 ARTICLES
SQL JOBS TWITTER FORMAT VIDEOS
How to display graphically a disk directory tree?

Execute the following Microsoft SQL Server T-SQL scripts in SSMS Query Editor to graphically display the folder structure without and with files:

-- SQL Server display directory tree graphically - folder structure

use AdventureWorks2008;

 

create table #FlatFile (Line varchar(300))

insert #FlatFile

exec master..xp_cmdshell 'tree k:\data'

 

select * from #FlatFile

go

drop table #FlatFile

/* Line

Folder PATH listing for volume Secondary

Volume serial number is E06B-AEAD

K:\DATA

+---Access2007

¦   +---Access2000

¦   ¦   +---archive

¦   ¦   +---sample1

¦   +---Backup

¦   ¦   +---ledger

¦   ¦   +---northwind

¦   +---Doc

....

*/

------------

 

-- SQL Server display folder structure graphically with files

use AdventureWorks2008;

 

create table #FlatFile (Line varchar(300))

insert #FlatFile

exec master..xp_cmdshell 'tree k:\data /F'

 

select * from #FlatFile

go

drop table #FlatFile

/* Line

....

¦   +---Export

¦   ¦   ¦   objects.sql

¦   ¦   ¦   SalesCategory.txt

¦   ¦   ¦   SalesCategory1.txt

¦   ¦   ¦   SalesDetail.txt

¦   ¦   ¦   SpecialOffer.txt

¦   ¦   ¦  

¦   ¦   +---Contact1

¦   ¦   ¦   ¦   CONTACT20070122.txt

.....

*/

------------

 

Exam Prep 70-461
Exam 70-461
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE