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:
#2:
精彩评论