SQLServerCentral.com / SQL Server 2008 / SQL Server 2008 Administration / Export table in to txt / Latest PostsInstantForum.NET v2.9.0SQLServerCentral.comhttp://www.sqlservercentral.com/Forums/notifications@sqlservercentral.comSun, 02 Aug 2015 14:28:56 GMT20RE: Export table in to txthttp://www.sqlservercentral.com/Forums/Topic1452185-1550-1.aspxHi,I could replicate the issue you are facing the copying the template query and pasting it in command prompt after making the required changes.Workaround: Just type the whole command in the command prompt and it will surely work :) I guess, there is some special character\Unicode conversion of space or something is causing an issue.. Not sure.. Let me know if you could find the exact culprit..RegardsBhav[url=http://ssisdevelopers.wordpress.com]ssisdevelopers.wordpress.com[/url]Wed, 15 May 2013 01:17:24 GMTBhavpreet Singh NarangRE: Export table in to txthttp://www.sqlservercentral.com/Forums/Topic1452185-1550-1.aspxHI Bhavpreet Singh Narang,I have try your command but there were error :For My Server Name : 10.67.172.202Database Name : morscdbTable name for query : dbo.AO_MTthe error like below ::\Documents and Settings\Administrator&gt;SQLCMD -S 10.67.172.202 -d morscdb -U sa-P sa -Q "Select* FROM dbo.AO_MT" -s "," -o "C:\Yourfilename.csv"sqlcmd: 'FROM dbo.AO_MT"': Unexpected argument. Enter '-?' for help.which one is wrong ? thank youTue, 14 May 2013 23:35:15 GMTtrisnoRE: Export table in to txthttp://www.sqlservercentral.com/Forums/Topic1452185-1550-1.aspxYou can run a Sql Command in the scheduled job to do the desired task for you. Following is the syntax for the same.SQLCMD -S YourSQLServer -d YourDatabase -U YourUserName -P YourPassword -Q “Your Query” -s “,” -o “C:\Yourfilename.csv"Feel free to get back in case of any issues.Tue, 14 May 2013 04:41:28 GMTBhavpreet Singh NarangRE: Export table in to txthttp://www.sqlservercentral.com/Forums/Topic1452185-1550-1.aspxThank you Sean Lange,This is routine work and will be running every hours, thanksMon, 13 May 2013 17:13:08 GMTtrisnoRE: Export table in to txthttp://www.sqlservercentral.com/Forums/Topic1452185-1550-1.aspx[quote][b]trisno (5/13/2013)[/b][hr]dear Gurus,I want to export data in table to txtSELECT [StatBeginTime] ,[MDASum] ,[BureauName] ,[MDA] FROM [kpidb].[dbo].[t_MDA_1]the result :2013-05-13 00:14:00.000 290 bjm 2616512013-05-13 00:29:00.000 226 bjm 2037672013-05-13 00:44:00.000 174 bjm 15730how to process so can create file txt in c:\\ directory ??? many thanks[/quote]Is this a one time export or something you need to do routinely?Mon, 13 May 2013 12:33:08 GMTSean LangeExport table in to txthttp://www.sqlservercentral.com/Forums/Topic1452185-1550-1.aspxdear Gurus,I want to export data in table to txtSELECT [StatBeginTime] ,[MDASum] ,[BureauName] ,[MDA] FROM [kpidb].[dbo].[t_MDA_1]the result :2013-05-13 00:14:00.000 290 bjm 2616512013-05-13 00:29:00.000 226 bjm 2037672013-05-13 00:44:00.000 174 bjm 15730how to process so can create file txt in c:\\ directory ??? many thanksMon, 13 May 2013 09:51:51 GMTtrisno