开发者

How do I use IF statement within Execute SQL task to create a temp table?

In my Execute SQL task I'm creating temp table with :

CREATE TABLE [tempdb].dbo.##temptable (开发者_开发技巧Header VARCHAR(200), Value VARCHAR(200))

but i need to put if condition like if(temp table is exist drop it and again create new one.)

How can i do this??


The SQL statement in the Execute SQL Task would be as following:

IF OBJECT_ID('tempdb..##temptable') IS NOT NULL
    DROP TABLE [tempdb].dbo.##temptable

CREATE TABLE [tempdb].dbo.##temptable (Header VARCHAR(200), [Value] VARCHAR(200))

Screenshots:

#1:

How do I use IF statement within Execute SQL task to create a temp table?

#2:

How do I use IF statement within Execute SQL task to create a temp table?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜