How to read the column values in activex script

  • I have a input message asking to enter the table name, this is assigned at @tablename which is used for all tasks in the packages, as soon as I enter the table name it shd validated the tablename i.e check whetehr the table name I have entered is correct or not.

    IF yes the table exists then main = succes else

    error the table name entered is worng.

     

    how shd I write this in activex script

    do I need to use ADO recordset or SQL task and activex script.

     

    thanks in advance.

  • I would write in a stored proc that checks against sysdatabases or sys.databases (2005)

    if object_id(N'dbo.uspCheckTableExists') is not null

    drop proc dbo.uspCheckTableExists

    go

    -- exec dbo.uspCheckTableExists 'mytable'

    create proc dbo.uspCheckTableExists

    @table varchar(256)

    as

    select

    case

    when count(*) > 0 then 'yay! table [' + @table + '] exists in ' + db_name() + ' database!'

    else 'uh oh! table [' + @table + '] does NOT exist in ' + db_name() + ' database'

    end

    from

    sysobjects

    where

    xtype='U' and

    name = @table

    go


    Cheers,

    Ben Sullins
    bensullins.com
    Beer is my primary key...

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply