hi there
i have written follwing SP
to add two columns in my table (passing tablename as parameter)
create procedure sp_addCol
@tablename varchar (50)
as
DECLARE @tsql_TZ varchar (200)
SET @tsql_TZ = 'ALTER TABLE [ '+@tablename+'] ADD timezone varchar (5)'
DECLARE @tsql_EXP varchar (200)
EXEC(@tsql_TZ)
SET @tsql_EXP = 'ALTER TABLE [ '+@tablename+'] ADD exported varchar (5)'
EXEC(@tsql_EXP)
when i try to execute the SP
using following command
execute sp_addCol 'MGV10SEP_MNPC_ MNLD'
it show me the error
Server: Msg 4902, Level 16, State 1, Line 1
Cannot alter table ' MGV10SEP_MNPC_M NLD' because this table does not exist in database 'SIL_TESTDB'.
Server: Msg 4902, Level 16, State 1, Line 1
Cannot alter table ' MGV10SEP_MNPC_M NLD' because this table does not exist in database 'SIL_TESTDB'.
but table is actually exist in database
please help
thanks & regards
i have written follwing SP
to add two columns in my table (passing tablename as parameter)
create procedure sp_addCol
@tablename varchar (50)
as
DECLARE @tsql_TZ varchar (200)
SET @tsql_TZ = 'ALTER TABLE [ '+@tablename+'] ADD timezone varchar (5)'
DECLARE @tsql_EXP varchar (200)
EXEC(@tsql_TZ)
SET @tsql_EXP = 'ALTER TABLE [ '+@tablename+'] ADD exported varchar (5)'
EXEC(@tsql_EXP)
when i try to execute the SP
using following command
execute sp_addCol 'MGV10SEP_MNPC_ MNLD'
it show me the error
Server: Msg 4902, Level 16, State 1, Line 1
Cannot alter table ' MGV10SEP_MNPC_M NLD' because this table does not exist in database 'SIL_TESTDB'.
Server: Msg 4902, Level 16, State 1, Line 1
Cannot alter table ' MGV10SEP_MNPC_M NLD' because this table does not exist in database 'SIL_TESTDB'.
but table is actually exist in database
please help
thanks & regards
Comment