![]() ![]() This time i have folder WS, what is more peculiar is i am able to see some txt file which shares location with jpg file under the folder WS, but couldn’t able to see jpg files. Thanks to heaven, i am able to see some result this time, but some bad news came my way. I have folder Test in E Drive, and have few jpg file inside Test Folder, but when i used below script it will give no result.Īs per my understanding, Test folder is just like that E:\Test, so depth should be 2 and i am looking for files, so third parameter is also 1.Īgain i have tried the same with C drive as below I have some work around with XP_Dirtree…… but couldn’t succeeded any how…. This will only retrieve children of 'C:\Program Files\Microsoft.NET' whose level SqlAndMeĮMail me your questions -> me on Twitter -> : xp_dirtree 'C:\\Program Files\\Microsoft.NET', 2 You can also restrict the number of level retrieved using:ĮXEC master. This returns all the children of 'C:\Program Files\Microsoft.NET' recursively, and their level from parent: xp_dirtree 'C:\\Program Files\\Microsoft.NET' If you need to retrieve the children recursively, you will need to use xp_dirtree.ĮXEC master. In this case it returns directories which are directly under 'C:\Inetpub' as below: Xp_subdirs – lists only directories which are direct children of the specified parent. In order toĬhose what fit your need you need to examine it case by case.You can use xp_subdirs and xp_dirtree undocumented stored procedures to retrieve a list of child directories under a specified parent directory from file system. When you use inline code the SQL Server query engine can parse the entire text and build a combine execution plan which is optinize for the whole process. Plan is optimized for the specific step and not for the entire process that we want to do. The big disadvantage (which is one of the advantage as well, depending on the case) of using temporary table is that the code execute in two steps, therefore the SQL Server Query engine built an execution plan for each step separately which mean that this Which writes the current in-memory modified pages from memory to disk. Once in a while, SQL Server do a CHECKPOINT operation Even when we read data (select) or write it (insert/update) to table, which is on disk, SQL Server will firstly read the data to the memory and work in memory. ![]() > Off the top of my head, would I be correct that Idr_p's approach would work in memoryīasically SQL Server always work in memory. Step, but using the approach in the second link that I posted: create one dynamic query using "for xml" hint, and execute it directly. You can avoid using temporary table and work in one ![]() ![]() In both links that posted the job is done in two steps: firstly we get the information, and secondly we use the data from step 1. You do not have to use the temporary table in order to avoid looping. SQL Server is a Tabular database, which based on SET, and we should avoid looping through records and working with it record by record, as much as we can!Ģ. There is no reason to do any looping in this case. Not a one that I recommends for most cases. With that was said, I think that your solution is Therefore all currect answer should be marked.ġ. Unlike a chat, a forum thread is here to stay, and future users (especially those that come from searching engine) might see the responses and choose a different That is great, this is the right way in my opinion if a question get several right responses. ![]()
0 Comments
Leave a Reply. |