Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
madmax1999
Starting Member
2 Posts |
Posted - 2005-03-16 : 10:37:40
|
| Hello! I should write a stored procedure that fills a table with folder and file names included in a specified path.Does anyone know wich Transact-SQL functions should I use or alternatively, how can I use windows API in stored procedure?Thank you very much, Massimo. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-03-16 : 10:49:52
|
| In the past I've done it with something likeCREATE TABLE dbo.ImportDIR( Path varchar(8000) NULL)INSERT INTO ImportDIR (Filename)EXEC master.dbo.xp_cmdshell 'dir x:\Mypath\*.* /s /b'Kristen |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-03-16 : 10:52:06
|
that's cool! i always forget you can do that....Go with the flow & have fun! Else fight the flow |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-03-16 : 11:19:07
|
| Yeah, but your whole permissions & hacking thingie might be better covered by using sp_OACreate. its a tad more complicated to build thoughKristen |
 |
|
|
madmax1999
Starting Member
2 Posts |
Posted - 2005-03-16 : 11:28:34
|
| Ok, I saw the books online definition of sp_OACreate but I don't know which object should I create that I could scroll to get my filenames in the directory...Any suggestion? Thank you 1.000.000! Massimo. |
 |
|
|
|
|
|