December 6, 2011

Export query results to Notepad

We have bcp utility in SQL Server we can easily write query results to notepad file.

T-SQL

EXEC xp_cmdshell 'bcp "SELECT * FROM sys.objects" 
queryout "C:\ExportDataToNotepad.txt" -T -c -t,'

That’s It.
Enjoy Learning.

No comments:

Post a Comment