dbTalk Databases Forums  

Uploading of a .CSV file into a temp table

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Uploading of a .CSV file into a temp table in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peri
 
Posts: n/a

Default Uploading of a .CSV file into a temp table - 11-13-2003 , 06:40 AM






I have a problem, Can any one help me out ?

I am using VB as a client and SQL server 2000 as the database.The user will
select a .CSV file from the VB Client which may contain a max of 1,00,000
records. I want to upload this file into the temp table, do some
manipulations in the temp table, show the mismatched records alone to the
user using VB Client and once he confirms, copy these records into the
original table.

To my knowledge, this can be done in 3 ways

1. Read the .CSV file from the VB client itself, do some manipulation in the
VB client and upload to the original table.
2. Read the .CSV file from the VB client, do some manipulation in the SQL
server using stored procedures and update into the original table from the
stored procedure itself.
3. Using DTS wizard, upload the file into the temp table, do some
manipulation in the SQL server using stored procedures and update into the
original table from the stored procedure itself. From VB Client, I will have
to call the store procedure by passing the file name, which in turns calls
the DTS wizard and executes the same.

I think the 3rd option is the fastest of all.

But in the third option, the issue is I want to pass the file name from the
VB client to a stored procedure, and from a stored procedure I will have to
call the DTS wizard by passing the file name and execute the same. Can this
be done in SQL server ?

FYI - The format of the file will not change. It is fixed.

Thanks,

-Peri



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Uploading of a .CSV file into a temp table - 11-13-2003 , 08:08 AM






Why not use the BULK INSERT task to do this in DTS. You can then pass in
the filename through the object model from VB
You then use TSQL to manipulate the temp table


--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peri" <peri (AT) cspl (DOT) com> wrote

Quote:
I have a problem, Can any one help me out ?

I am using VB as a client and SQL server 2000 as the database.The user
will
select a .CSV file from the VB Client which may contain a max of 1,00,000
records. I want to upload this file into the temp table, do some
manipulations in the temp table, show the mismatched records alone to the
user using VB Client and once he confirms, copy these records into the
original table.

To my knowledge, this can be done in 3 ways

1. Read the .CSV file from the VB client itself, do some manipulation in
the
VB client and upload to the original table.
2. Read the .CSV file from the VB client, do some manipulation in the SQL
server using stored procedures and update into the original table from the
stored procedure itself.
3. Using DTS wizard, upload the file into the temp table, do some
manipulation in the SQL server using stored procedures and update into the
original table from the stored procedure itself. From VB Client, I will
have
to call the store procedure by passing the file name, which in turns calls
the DTS wizard and executes the same.

I think the 3rd option is the fastest of all.

But in the third option, the issue is I want to pass the file name from
the
VB client to a stored procedure, and from a stored procedure I will have
to
call the DTS wizard by passing the file name and execute the same. Can
this
be done in SQL server ?

FYI - The format of the file will not change. It is fixed.

Thanks,

-Peri





Reply With Quote
  #3  
Old   
Peri
 
Posts: n/a

Default Re: Uploading of a .CSV file into a temp table - 11-13-2003 , 09:21 AM



I am not able to get you. Can you please explain in detail and the steps to
be followed.

What do you mean by Object model from VB ? Can you please explain this also
?

With best regards,

-Peri

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Why not use the BULK INSERT task to do this in DTS. You can then pass in
the filename through the object model from VB
You then use TSQL to manipulate the temp table


--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peri" <peri (AT) cspl (DOT) com> wrote in message
news:eoTDoaeqDHA.2636 (AT) tk2msftngp13 (DOT) phx.gbl...
I have a problem, Can any one help me out ?

I am using VB as a client and SQL server 2000 as the database.The user
will
select a .CSV file from the VB Client which may contain a max of
1,00,000
records. I want to upload this file into the temp table, do some
manipulations in the temp table, show the mismatched records alone to
the
user using VB Client and once he confirms, copy these records into the
original table.

To my knowledge, this can be done in 3 ways

1. Read the .CSV file from the VB client itself, do some manipulation in
the
VB client and upload to the original table.
2. Read the .CSV file from the VB client, do some manipulation in the
SQL
server using stored procedures and update into the original table from
the
stored procedure itself.
3. Using DTS wizard, upload the file into the temp table, do some
manipulation in the SQL server using stored procedures and update into
the
original table from the stored procedure itself. From VB Client, I will
have
to call the store procedure by passing the file name, which in turns
calls
the DTS wizard and executes the same.

I think the 3rd option is the fastest of all.

But in the third option, the issue is I want to pass the file name from
the
VB client to a stored procedure, and from a stored procedure I will have
to
call the DTS wizard by passing the file name and execute the same. Can
this
be done in SQL server ?

FYI - The format of the file will not change. It is fixed.

Thanks,

-Peri







Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Uploading of a .CSV file into a temp table - 11-16-2003 , 09:11 AM



DTS has an object model that you can manipulate for your package when you
call it.

How can I change the source data file
for a Bulk Insert Task
(http://www.sqldts.com/default.aspx?231)

In this example a Global Variable is assigned to the property of the text
file name. This can be populated using the Dynamic properties task or you
can simply convert this piece of VBScript into VB to run in your program.

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peri" <peri (AT) cspl (DOT) com> wrote

Quote:
I am not able to get you. Can you please explain in detail and the steps
to
be followed.

What do you mean by Object model from VB ? Can you please explain this
also
?

With best regards,

-Peri

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:ekJx#9eqDHA.372 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Why not use the BULK INSERT task to do this in DTS. You can then pass
in
the filename through the object model from VB
You then use TSQL to manipulate the temp table


--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peri" <peri (AT) cspl (DOT) com> wrote in message
news:eoTDoaeqDHA.2636 (AT) tk2msftngp13 (DOT) phx.gbl...
I have a problem, Can any one help me out ?

I am using VB as a client and SQL server 2000 as the database.The user
will
select a .CSV file from the VB Client which may contain a max of
1,00,000
records. I want to upload this file into the temp table, do some
manipulations in the temp table, show the mismatched records alone to
the
user using VB Client and once he confirms, copy these records into the
original table.

To my knowledge, this can be done in 3 ways

1. Read the .CSV file from the VB client itself, do some manipulation
in
the
VB client and upload to the original table.
2. Read the .CSV file from the VB client, do some manipulation in the
SQL
server using stored procedures and update into the original table from
the
stored procedure itself.
3. Using DTS wizard, upload the file into the temp table, do some
manipulation in the SQL server using stored procedures and update into
the
original table from the stored procedure itself. From VB Client, I
will
have
to call the store procedure by passing the file name, which in turns
calls
the DTS wizard and executes the same.

I think the 3rd option is the fastest of all.

But in the third option, the issue is I want to pass the file name
from
the
VB client to a stored procedure, and from a stored procedure I will
have
to
call the DTS wizard by passing the file name and execute the same. Can
this
be done in SQL server ?

FYI - The format of the file will not change. It is fixed.

Thanks,

-Peri









Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.