May 16, 2014 at 2:21 pm
I have been assigned a task to have a query, which a developer wrote, run against a database on a daily basis and have it generate a csv file to be placed on a network drive.
Another tech suggested I use the xp_cmdshell to do this, but when I tried on a test server it said that the extended properties are not enabled.
We are running SQL 2008 here
The senior DBA suggested that we use PowerShell to do the task, but my powershell skills are not that great.
Do you have any suggestions on how I can accomplish this job?
Your help is appreciated
Jeff
May 16, 2014 at 2:36 pm
What about SSIS?
😎
May 16, 2014 at 3:40 pm
I would go with SSIS as well, but if you want to do it with Powershell, there are plenty of examples in the web.
A search on google for "powershell export sql server csv" gave several posts.
Here are some examples.
http://www.sqlteam.com/article/fast-csv-import-in-powershell-to-sql-server
May 16, 2014 at 4:12 pm
Thanks for the feedback, I will look into it.
Jeff
May 17, 2014 at 6:51 am
jayoub (5/16/2014)
I have been assigned a task to have a query, which a developer wrote, run against a database on a daily basis and have it generate a csv file to be placed on a network drive.Another tech suggested I use the xp_cmdshell to do this, but when I tried on a test server it said that the extended properties are not enabled.
We are running SQL 2008 here
The senior DBA suggested that we use PowerShell to do the task, but my powershell skills are not that great.
Do you have any suggestions on how I can accomplish this job?
Your help is appreciated
What does the file have to look like? For example, should column headers be included?
What about the data? For example, is there any possibility that the data might include a comma in it? If so, is a TAB delimited file an option?
Last but not least, what is the end use of the data? Is it for imports to something like Excel or is it a file that will be transmitted to somewhere else?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply