Tuesday, August 17, 2010

Export data from SQL Server to notepad

Leave a Comment

Last week during a training session, one of trainee raised a simple question. “Is there any

easy method to export data from sql server to notepad file”, b/c that poor fellow has been copy pasting it in the recent past. So I thought might be some more guys are there to find that simple answer. So I follow these simple steps:

As clearly shown in below picture I opened Import & export Wizard


From Choose data source section I choose AdventureWorks db. For the sake of simplicity I don’t change the default attributes.



In choose destination step, I have choosen flat file destination from destination drop down list, give it name C:\HumanResouceShift.txt and checked column names checkbox to get columan names as well.

In specify table copy or query, I choose first option due to make it simple enough for a power use to export the date, else by choosing second option, I can write my own tsql query to extarct data from destination

In next step in the wizard which is to configure flat file destination I choose HumanResources.Shift table.

I can choose from available option to put delimeters within column as well as b/w rows. But in this case I choose default options.


In final step which is Save & Run package, I choose run immediately. (In future blogs I will wirte in detail about saving it as SSIS pacakge & its protection level.

If everything goes well execution successful then I should have a file at my C: drive which I choose as my destination


If You Enjoyed This, Take 5 Seconds To Share It

0 comments: