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 VIDEOS
 
 
SQL E/BOOKS   WORLD, USA & SQL NEWS   FORMAT
SCRIPTS SQL 2005 SQL 2008 ARTICLES
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
SQL 2016 DESIGN & PROGRAMMING
 
 
 
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