Hi friends; i have this SP insql server and work Good...
but some times sql can't drop table in top of my code. why?
GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[GetStationCountAndOnlineStationsListGrroupByProvince_Ranking] @FK_RegionID bigint AS BEGIN -- Some times can't drop table and i have to drop it manually begin try drop table tblinfo end try begin catch end catch select tblstations.StationID,stationname,tblstations.WMOCode,tblStations.IKAOCode,StationTypeName,tblstations.IsAutoStation,Stations_OnlineList.logtime as 'OlineDataTime' ,Stations_LogTimeList.logtime as 'LogTime' into tblinfo from tblstations inner join tblStationTypes on tblstations.FK_StationTypeID=tblStationTypes.StationTypeID inner join Stations_LogTimeList on Stations_LogTimeList.StationID=tblstations.stationid inner join Stations_OnlineList on Stations_OnlineList.StationID=tblstations.stationid where tblstations.FK_RegionID=@FK_RegionID and tblstations.Active=1 select StationID,stationname,WMOCode,IKAOCode,tblinfo.StationTypeName,OlineDataTime,LogTime,IsAutoStation, case when OlineDataTime>DATEADD(hour,-2,getdate()) then 'true' else 'false' end as 'Parameter' ,case when LogTime>DATEADD(hour,-5,getdate()) then 'true' else 'false' end as 'Report' from tblinfo end