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
 SQL Server Development (2000)
 Ms sql database to csv file...........

Author  Topic 

xanthoprotein
Starting Member

2 Posts

Posted - 2004-07-20 : 08:51:35
sir/ madam...

i am faced with a problem, kindly help me out. i am in process of building an application on C# over .net platform which allows one to copy Ms sql database (situated in a remote machine, ie. ms sql database server) into a *.csv file situated at clients machine along with ms sql client. the database has many tables and all of these tables along with their column attributes and value have to be mapped to the attributes in the csv file which i have created over ms excel.

first issue: how do i achieve this sort of mapping. for eg: we can map one table in the database to one corresponding csv file, but the issue is mapping all tables and its attributes to a single csv file. how do i achieve this over the dts utility available in the enterprise manager of ms sql.Do i have to manually go through every table and set the column name in the *.csv file.

second issue : how do i copy the values ie. on execute package of dts it should copy all the contents of this database to that csv file.

third issue: how can generate the corresponding script of that particular package which is compatible over .net platform and can easily be ported to c# form.

fourth issue: are there any ways to better the performance, ie. is there any way that even though this application runs at the client end , the copying of data takes place at the database server end itself so that the whole of data need not travel across the network to the client machine.

looking forward for assitance

nabendu misra

joy

JasonGoff
Posting Yak Master

158 Posts

Posted - 2004-07-20 : 09:18:15
What are you trying to achieve on the client with all this data in one CSV file ?

1. Bad idea. Look at using XML, Disconnected recordsets or something that gives you hierarchy.
2. Use datapump tasks within the DTS to export the data.
3. DTS packages can't be "scripted".
4. Yes. Look at ADO.Net. Disconnected recordsets executing stored procedures to return just the data your interested in. These recordsets can then be persisted on the local machine.

Again, very difficult to advise on the best process without understanding the business requirements of the application.
Go to Top of Page

xanthoprotein
Starting Member

2 Posts

Posted - 2004-07-20 : 09:40:36
sir,
according to the requirement as provided. i have to create an application which allows one to create a backup of the sql database in a *.csv file....which on client delivery will obviously be located at the server end. but presently i am keeping it at my end , as i don't have access to put a new *.csv file on the server. the application designed over c# currently implements dts_package class or dll (whatever i don't know) for copy a database from sql to another sql database. (along with some given functionalities, ie. the user can choose to copy entire database or individual tables, the user also has choice to choose to copy data between two different databases ie. either source database can be sql or oracle and destination database can be oracle or sql. once the database is choosen , the list of available servers are shown to him. after which he can specify the source database and target database.) till now the program implements dts internally , and it has come to my knowledge that one can make the package of tasks and execute it, if u want a programmatic block then one has to record the package while executing and VBscript of that corresponding package is generated. that script forms our programmatic block which has to customized according to our needs...........but this i have only heard , how to achieve it is what i am trying to achieve this moment. again copying between database and *.csv file is a client requirement which has to be achieved over c#.net , copying an entire database to a
*.csv file with all information about the tables, its key constraints, and column names along with values is what has to be obtained. how we r going to achieve it the solution to my problem

thanking u for response.

joy
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-07-20 : 12:45:05
How is the structure of the csv file specified ? ( Metadata Interchange Format )
Ok, So now the Client gets a .csv containing all the data and metadata of an SQL Server database, What is it going to do with that ?
Talk about reinventing the wheel...

/rockmoose
Go to Top of Page
   

- Advertisement -