Creating multiple subfolders using MKDIR from a command prompt

March 11, 2009
Some time you need to create several subfolders inside a folder and name them appropriately.

One way is to create each folder seperately with appropriate name. This method would be fine if you had to create only a few folders. But if you need to create several such folders. Doing it using the above method would be quite tedious and time consuming.

Here is a little command prompt trick which helps to do this easily.

Step 1: Open notepad and type list of folder names which you want to create with each name separated by space as shown below.

Step 2: Save the above file as “FolderNames.txt” in the folder in which you want to create the sub-folders as shown below. (Note: Here I save it under “C:\MultiFolder” directory)



Step 3: Open the command prompt in that folder and type the following command as shown below.

<FOR /F “tokens=*” %n IN (FolderNames.txt) DO MKDIR %n>



Step 4: Now you can see all the subfolders created successfully as shown below.



With this example, FolderNames.txt file containing the line

<subFolder1 subFolder2 subFolder3 subFolder4 “sub Folder 5″>

Which will results to create five subfolder with the name subFolder1, SubFolder2, subFolder3, SubFolder4 and “sub Folder 5“.


Welocome to techlamp

December 21, 2008
This is my first post in my blog. I am so happy that I am going to share all my knowledge to you all.
Keep visiting!!! :-)

blogger.techlamp

Common Table Expressions (CTE) on SQL 2005

October 24, 2008

Common Table Expressions (CTE) is a new feature in SQL Server 2005. It’s an expression that returns a temporary result set. It can be used with both selects and DML statements.

Normally Temporary tables allow you to split a complex query or a query that, if built as one unit, would run slow due to the complexity of the joins SQL Server would have to do. Therefore, creating a set of sub-data in the first query would aid the performance of the query in the second.

Syntax:

[ WITH <common_table_expression> [ ,...n ] ]

<common_table_expression>::=

expression_name [ ( column_name [ ,...n ] ) ]

AS

( CTE_query_definition )

)

Example:

USE AdventureWorks

GO

WITH MyCTE(ListPrice, SellPrice)
AS

(
SELECT ListPrice, ListPrice * 2.5

FROM Production.Product

)

SELECT ListPrice, SellPrice

FROM MyCTE order
by ListPrice desc

GO

Screen shot:

Explanation:

Above example will display ListPrice and SellingPrice with help of CTE (Temporary table). In this way any kind of complex query can be replaced with help of CTE.

Conclusion:

New in SQL 2005, Common Table Expressions will be worth exploring for anyone doing TSQL work.


How to manage many blogs?

October 15, 2008

One of my friend asked me how do I manage my blog. The answer is simple. Just update when you have time.

As a blogger, you need to have your own ideas. With the ideas, you can craft your words to make it interesting. There are many ways that you can get the ideas. For an example by visiting other peoples blog. Let say when you found my website and browse through my posts. Then, a post had catched your eyes and it is very interesting. So what you need to do next? Write the same article topic but with your own opinion. Take yout time to write the article. Don’t rush. There is nothing chasing you behind. So sit down, open up your favourite blog editor (I use Blogdesk btw) and write your ideas. When you done, just click Publish when you are ready. Simple isn’t? That is how I manage my blogs. Update them when I have time or you can make it like this.