1===================================================================
--i have not created the #facility table
--but if i execute the below statement
select facility_id,Facility_Name into #facility from tbl_facility where hub=1
it successfully inserts....
2==========================================================================
---but if i do like this--i am not creating #facility table
select facility_id,Facility_Name from tbl_facility where hub=1
union all
select facility_id,facility_name from tbl_facility where facility_id=145
into #facility4
--it gives me error
--Incorrect syntax near the keyword 'into'.
3=====================================================================
--and if i do like this--i am not creating #facility table
select facility_id,Facility_Name into #facility5 from tbl_facility where hub=1
union all
select facility_id,facility_name into #facility5 from tbl_facility where facility_id=145
There is already an object named '#facility5' in the database.
--i changed it to #facility6 ..same error....
i am pondering over it....why this error is coming...if step 1 works fine,,,
then step 2 or 3 should also work fine,,,,