I work on SQL server 2012 i face issue
when make drop to table on begin of procedure it not working issue until I do by hand ?
so if i alter table Extractreports.dbo.PartGeneration by adding new column as onlineid on other place
then execute [Parts].[sp_get_parts] it give me error invalid column name onlineid
ok but i make drop on start of procedure why error display
so when i go on server then execute following statment as below
and run
IF OBJECT_ID('Extractreports.dbo.PartGeneration') IS NOT NULL
DROP TABLE Extractreports.dbo.PartGeneration
IF OBJECT_ID('Extractreports.dbo.getInsertedRows') IS NOT NULL
drop table Extractreports.dbo.getInsertedRows
when execute again error not display
it working only when go every time and execute from server for drops tables
create Proc [Parts].[sp_get_parts]
AS
BEGIN
IF OBJECT_ID('Extractreports.dbo.PartGeneration') IS NOT NULL
DROP TABLE Extractreports.dbo.PartGeneration
IF OBJECT_ID('Extractreports.dbo.getInsertedRows') IS NOT NULL
drop table Extractreports.dbo.getInsertedRows
--SOME LOGIC
select partid,companyname into Extractreports.dbo.PartGeneration from dbo.parts
select family,plname into Extractreports.dbo.getInsertedRows from dbo.parts
END
so how to solve this issue