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!

DTS Package - Destination Table

Status
Not open for further replies.

moonmonkey

Programmer
Jul 16, 2002
14
0
0
GB
Hi. I am creating a VB function which uses DTS to transform a DBF file into a SQL Server 2000 table. This works fine, except the problem is, that I cannot assume that the destination table exists.

When you create the package manually in design view, there is a button which allows you to create the destination table, if it doesn't exist.

My VB function needs this functionality. Does anyone have any idea of how to do this, or how to script up a table from the DBF file.

Thanks,
 
hi,

why don't you create that table before running for DTS ,
if its already exists then you can simply delete it and create new one with the same structure, this is very simple process na ,

Thanks
 
Create a step that creates the table. If it fails, do the next step anyway
 
or how about something like this, create the table only if it doesnt already exist

if not exists (select * from dbo.sysobjects where id = object_id('[dbo].[yourtable]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)

CREATE TABLE [dbo].[yourtable] (
blah blah

)
go



Matt

Brighton, UK
 
Thanks, but I don't think I've not explained myself well enough here. This should be a very flexible function. Lets assume for arguments sake that I don't know much about opening cheetah databases.

However, once SQL Server has opened a connection, it knows the table structure of the source data, including data types.

In the designer, you can generate the destination table script and execute it before hand, because it gives you that option if the destination table does not exist.

Any ideas?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top