deba_20032004
Default port
Points: 1476
More actions
December 23, 2011 at 6:35 am
#248717
Dear Sir,
I have no idea regarding above this topic. But I need to export query result set to excel sheet through sql statement how to possible Plz give me an idea and a sample copy.
Thanking You
Debasis Bag
Eralper
SSCarpal Tunnel
Points: 4438
December 23, 2011 at 7:12 am
#1425161
Hello,
You can use BCP command with xp_cmdshell for your requirement
Please check the tutorial for a sample case at http://www.kodyaz.com/articles/sql-output-to-file-using-sql-server-bcp-command.aspx
Here is a sample
DECLARE @s-2 nvarchar(4000)
SET @s-2 = 'BCP "SELECT * FROM TableName" queryout "d:\file.xls" -c -UTF8 -T -Sservername'
EXECUTE master..xp_cmdshell @s-2
EralperSQL Server and T-SQL Tutorials and ArticlesMicrosoft Certification and Certification Exams
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply