0

I am trying to pass a datatable to my procedure.

I have created a SQL Server user-defined table type as below:

 CREATE TYPE dbo.DT_SimQuestionWebTemp AS TABLE 
 (
        [id] [bigint] IDENTITY(1,1) NOT NULL,
        [SimId] [bigint] NOT NULL,
        [mobile] [nvarchar](25) NOT NULL,
        [LevelId] [int] NULL,
        [QuestionId] [int] NULL,
        [Question] [nvarchar](500) NULL,
        [Answer1] [nvarchar](100) NULL,
        [Answer2] [nvarchar](100) NULL,
        [Answer3] [nvarchar](100) NULL,
        [Answer4] [nvarchar](100) NULL,
        [Answer5] [nvarchar](100) NULL,
        [Status] [int] NOT NULL
 )

I am trying to drop the table to create again with different schema using the below syntax.

drop table DT_SimQuestionWebTemp

however I am getting an error:

Cannot drop the table 'DT_SimQuestionWebTemp', because it does not exist or you do not have permission

and I have permission to drop tables and also I am able to use the table from the stored procedure. However I am not able to drop it or select from it through a normal query.

Any idea how to see the table and drop it?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
nayef harb
  • 753
  • 1
  • 10
  • 19

2 Answers2

0

You need drop type not drop table

 DROP TYPE dbo.DT_SimQuestionWebTemp
Martin Smith
  • 438,706
  • 87
  • 741
  • 845
0

What you need is:

DROP TYPE dbo.DT_SimQuestionWebTemp;
Lawrence
  • 111
  • 4