Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Import/Export

Status
Not open for further replies.

malladisk

Programmer
Jun 14, 2001
69
0
0
US
Hi!
I have a text file in which I have data which I'd like to import into an SQL Server database. DTS seems to offer limited options so I'd like to write a program in C which reads this text file and parses the file and stores the values read from this file into the database.
Also, I need to export the database into a text file in a predefined format that is different from the default export provided by DTS.
So my question is: Is there a simple way to write a C/C++ program that accesses the SQL Server database and can read from and write to the database? In other words, how do I access the SQL Server database from within a C/C++ program. Is there an equivalent of Pro*C for SQL Server?
Can anyone point me in the right direction?
Thanks,
Sashi
 

I can't answer the C/C++ question but would like to respond to the statement that "DTS seems to offer limited options."

DTS supports a wide variety of heterogenous data sources. It can perform complex transformations - such as aggregation, summarization, derivations, concatenations, output complex values based on multiple input columns, etc. You can use ActiveX scripts, data driven queries, lookups, the DTS COM interface, etc.

I'm no expert in DTS but it offers much more power than many of realize. I just bought the book "Professional SQL Server 2000 DTS" by Mark Chaffin, Brian Knight and Todd Robinson. It has really opened my eyes to the power of DTS.

DTS may not provide the solution you need but I'm convinced that it will handle a lot of our most complex import/export tasks. Terry Broadbent
Please review faq183-874.

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Hi
You can do import export using c or any other language,, using text files...
Its very simple using BCP
You can create Text files using BCP like this
from SP
u can use XP_CMDSHELL
and
bcp ajaydb..ltt_emp out c:\ltt_emp.txt -c -Usa -Psa -

SmyServer

same way you can import...
bcp ajaydb..ltt_emp in c:\ltt_emp.txt -c -Usa -Psa -

SmyServer


There are a lots of powerfull options with it like
Format text files etc etc.. .you want to read the BCP help
and XP_CMDSHELL help

CHOW
Have Fun
PeaceMaker ( Ajay )
ajaydak@hotmail.com







same way



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top