Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

How to place a file into a file directory.

$
0
0
Hi I have this code, which is just a part of my code:[quote]SET @Attachment = @FilePath + @ReportFileNameSELECT @SQLCommand = 'BCP "SELECT * FROM ##!TableName!" QUERYOUT ' + @FilePath + @ReportFileName + ' -c -t, -T -S' + @@SERVERNAME EXEC MASTER..XP_CMDSHELL @SQLCommandEXEC MASTER..xp_fileexist @Attachment, @FileExistsEmailFlag OUT IF @FileExistsEmailFlag = 1BEGIN EXEC msdb..sp_send_dbmail @recipients = @Recepients ,@copy_recipients = @CC ,@subject = @EmailSubject ,@file_attachments = @Attachment ,@body_format = 'HTML'END[/quote]That send the attachment, however the files can be bigger. I need to rather place a file in the directory then send email that the file can be found that directory. please help.

Viewing all articles
Browse latest Browse all 3145

Trending Articles