Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 How to check Existence of Excel Table

Author  Topic 

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2012-04-17 : 08:33:10
[code]Hi
In SSIS when we need to create the excel file dynamically ..we do use
command to create excel table first in SQL Execute task which I have done in may package by using the below command this command has single quotes :

DROP Table `TPricingSubsCount`
GO
CREATE TABLE `TPricingSubsCount` (
`RenewMonth` NVARCHAR(50),
`TieredPricingPlanEnglish` NVARCHAR(50),
`SubscriberCount` INT[/code]

My Issue is I want to check the existence of the excel table and then
want to drop it otherwise it will create . This algorithm is like SQL but not able to find out the existence of table.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-04-17 : 09:18:10
You can check for the existence using the following
IF (OBJECT_ID('TPricingSubsCount') IS NOT NULL) DROP TABLE TPricingSubsCount;
You might want to add additional checks to see if it really is a base table etc. if there is the possibility that an object that is not a base table with that name might exist.
Go to Top of Page
   

- Advertisement -