Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 .csv from SQL 2000

Author  Topic 

kokkie
Starting Member

1 Post

Posted - 2014-10-09 : 13:07:39
Hi

I need to have an automated extract from a sql 2000 who creates me .csv file
every end of the month.

Unfortunately the DB is an SQl 2000 .
so im not the Power Admin of SQL 2000.

Any one a ideas how it can create this extract job on a SQL DB?

Following Query will be used:

Use XXXX
select PH.storeId,
PH.Workdate,
PT.Tendered,
RIGHT(PLC.CardNo,13) CardNo
from PosHeader PH
JOIN PosTransactions PT
ON PH.HeaderID = PT.HeaderID
JOIN PosLoyaltyCusts PLC
ON PT.GlobalTxnID = PLC.GlobaltxnID
WHERE PT.IsVoided = 0
AND PT.IsTranining = 0 and Ph.WorkDate between '2014-06-30 00:00:00' and '2014-09-28 00:00:00'

Hope some one have any idications how i can relase this on the SQL 2000.
THX!
kokkie

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-10-09 : 14:00:12
Put the query into a view. Then run this command in a cmd window, modifying the parameters:

bcp "select * from XXXX.dbo.viewname" queryout c:\temp\somefile.csv -T -Sserver1\instance1 -c -t, -r\r\n

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -