Showing posts with label exists. Show all posts
Showing posts with label exists. Show all posts

Wednesday, March 21, 2012

DTS package to check if table exists

Hi all,

I have created a DTS package in SQL Server that takes Excel file and updates the database. The problem that i run into is - sometimes XLS file does not have any records in the table, and in this case i do not want DTS to execute and update the database.

The question is how to check ( i think usign Active X) if the exel table has any values in there or if it is blank?

a lot of thanks in advance,

Dmitry

yeah, and by the way,

when i execute the DTS i can see how many records are taken from XLS and copied into the database, if i can just somehow check that number, retreive that varible... that would solve the problem.

thanks again,

Dmitry

|||

It is often a good idea to import data into 'holding tables' (duplicate schema to the production tables), do whatever data cleanup/manipulation is required, and then move the data to the final tables.

With that process, it is easy to determine rowcount, duplications, etc, before running other code.

|||

ok...sounds ok, i have never done them before though... can you link an example or something..

many thanks

Sunday, February 19, 2012

DTS Insert or Update

Is there an easy way with DTS to pump data from one table to another so that it will update the row if it exists (the source and destination have the same value for the ID colum) or insert it if it doesn't.

I know this can be done with stored procedures/sql by doing IF EXISTS UPDATE ELSE INSERT but there are many tables and columns and this will be very tiime consuming.

i think your going to have to use VBScript in the transformation step of the DTS Package to evaluate if the record exists. Similar to what one would do in the stored proc.

hth,

mcm

DTS in SQL Server Express

Does anyone know if DTS exists in SQL Server Express?

Thank you,

Adamus

It does not|||

Thank you Euan,

I can use DTS packages and convert them to vb.net...however some of the code doesn't convert properly, but I can recode it.

Thank you,

Adamus