Hi I have a MS SQL db script, I have the same temp table declared more than once. I keep getting this error: There is already an object named ????(question marks are representative of table name) in the database. the following resembles what my script looks like.
IF OBJECT_ID('tempdb..#table123') IS NOT NULL
DROP TABLE #table123
CREATE TABLE #table123(
-- Key Fields
Student Integer NOT NULL,
ProcessDate DateTime NOT NULL,
JoinDate DateTime NULL,
FaceDate DateTime NULL,
FinalDate DateTime NULL,
Cash Money NULL,
SubjectCode Char(5) NULL
)
CREATE TABLE #table567...
CREATE TABLE #table135..
-- Then I have the first table again, I drop it first then create it again as before:
IF OBJECT_ID('tempdb..#table123') IS NOT NULL
DROP TABLE #table123
CREATE TABLE #table123(
-- Key Fields
Student Integer NOT NULL,
ProcessDate DateTime NOT NULL,
JoinDate DateTime NULL,
FaceDate DateTime NULL,
FinalDate DateTime NULL,
Cash Money NULL,
SubjectCode Char(5) NULL
)
If you have any ideas please let me know.