DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
SITE SEARCH SQLUSA.com HEADLINES NEWS
SQL E/BOOKS   SQL 2014 PROGRAMMING   DOWNLOADS
SCRIPTS SQL 2005 SQL 2008 ARTICLES
SQL JOBS TWITTER FORMAT VIDEOS
How to export a table into a Notepad file?

Execute the following SQL Server T-SQL script in SSMS Query Editor to export the content of a table into a text file:

USE AdventureWorks;

DECLARE @NotePadFile varchar(40), @CommandText varchar(4096)

SET @NotePadFile = 'e:\data\export\product'+CONVERT(char(10),GETDATE(),111)+'.txt'

SET @CommandText = 'bcp "SELECT * FROM AdventureWorks.Production.Product ORDER BY ProductNumber" queryout "'
SET @CommandText = @CommandText + @NotePadFile + '" -S"ServerName" -U"login" -P"password" -c'

EXEC master..xp_cmdshell @CommandText

 

Exam Prep 70-461
Exam 70-461
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE