I need to create .xlsx file exporting data from sql database and file name would be 'FileName' and current yyyymmdd.
I'm using following code.
declare @filepath nvarchar(4000); set @filepath = '\file1\Shared\Buying Report\NewFile' + CAST(YEAR(CURRENT_TIMESTAMP) AS VARCHAR)+ RIGHT('00'+CAST(MONTH(CURRENT_TIMESTAMP) AS VARCHAR),2)+ RIGHT('00'+CAST(DAY(CURRENT_TIMESTAMP) AS VARCHAR),2)+'.xlsx'
EXEC p_CreateExcel @db_name='st01', @table_name = 'Austomate_report', @file_name = @filepath
I enabled xP_cmdshell on my server also give right permission to destination folder and File got created at provided path with YYYYMMDD but not getting data copy on the file. Let me show you what's it shows me.
1,output NULL Starting copy... NULL 1 rows copied. Network packet size (bytes): 4096 Clock Time (ms.) Total : 1 Average : (1000.00 rows per sec.) NULL
2,output
NULL Starting copy... 1000 rows successfully bulk-copied to host-file. Total received: 1000 1000 rows successfully bulk-copied to host-file. Total received: 2000 1000 rows successfully bulk-copied to host-file. Total received: 3000 NULL 3741 rows copied. Network packet size (bytes): 4096 Clock Time (ms.) Total : 94 Average : (39797.87 rows per sec.) NULL
3,
output The system cannot find the path specified. NULL
Aucun commentaire:
Enregistrer un commentaire