Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 need tips

Author  Topic 

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-06-14 : 07:06:38
IF @GO=1
BEGIN
SELECT A INTO #WS_DEPTS1 FROM TABLE1
END
ELSE
BEGIN
SELECT A INTO #WS_DEPTS1 FROM TABLE2
END



Msg 2714, Level 16, State 1, Procedure ParseXmlPersonInfo, Line 155
There is already an object named '# WS_DEPTS1' in the database.

kmkmmm

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-14 : 07:12:33
same as

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926&whichpage=29

answered in original thread

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-06-14 : 07:22:56
thank you visakhm



can examples ?


kmkmmm
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-14 : 07:37:09
[code]
CREATE TABLE #WS_DEPTS1
(
A <datatype same as that in TABLE1>
)

IF @GO=1
BEGIN
INSERT #WS_DEPTS1
SELECT A FROM TABLE1
END
ELSE
BEGIN
INSERT #WS_DEPTS1
SELECT A FROM TABLE2
END
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -