Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Guys,

I'd like to export Table from SQL database to *.CSV file (mapped Table to CSV) periodically at the end of each shift automatically. I heard that it can be done using SSIS.

Also I have a condition while mapping source to destination based on two columns value in the table

one of the columns, header4, value =1 or 2 or 3 where only the rows whose value is 1 need to be uploaded to csv, value 2 0r 3 no need to upload.

another column header5, value= 1 or 2 where 1= Existed column name so search the same name in csv and append the rows , 2= Add one more new column to csvfile and upload data for appending

Finally i want this to be a executable file... because to send customer
I am new to SSIS and SSMS as well, pl help me

How to attach the excel here,which i made sample

Thanks
Posted

1 solution

Create a view that returns the data you are looking for. eg:

SQL
select FIELDLIST from TABLENAME where header4 = 1


Then use the view in a data transformation package (I know they are called something else these days, but it's the same thing) that exports the results to CSV. Use the Task Scheduler to schedule this to happen as needed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900