Saving a whole datatable to SQL server 2000

P

Pipo

Hi,

I am looking for some sample (code) on how to save a complete datatable into
SQl server 2000.
I want to save the datatable (filled with datarows and values) and later on
I need to load it back again.

Does anyone know if this is possible and how?

tia,

Pipo
 
M

Mansi Shah

Hi,

For this you have to create 1 table in database through coding, can be
your datasets name. If you have table then you have to map the fields to
that table. Then you can retrive it from datatbase.

Regards,
Mansi Shah.
 
P

pipo

Hi Mansi,

Thank you for your reply.

I want to save the whole datatable to 1 record in de database.
The datatables I want to save and retrieve are different and not always the
same.
That is why I cant create tables for it in the database.

tia,
Pipo
 
J

Jim Rand

Serialize the datatable to xml and save the resulting string in a varchar
field. If it's more than 8K characters, you will either have to compress it
and base64encode it (86% compression) or save it as a blob.
 
C

Cor Ligthert[MVP]

Jim,

That is the same as I thought, with the difference, that I would zip the XML
string and then add it to an bytearray (image/blob) field

Cor
 
W

William Vaughn

SSIS can do this. SqlBulkCopy can do this. BCP, DTS can also do this.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top