SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 need tips
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pascal_jimi
Posting Yak Master

Azerbaijan
150 Posts

Posted - 06/14/2013 :  07:06:38  Show Profile  Visit pascal_jimi's Homepage  Reply with Quote
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

India
52325 Posts

Posted - 06/14/2013 :  07:12:33  Show Profile  Reply with Quote
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

Azerbaijan
150 Posts

Posted - 06/14/2013 :  07:22:56  Show Profile  Visit pascal_jimi's Homepage  Reply with Quote
thank you visakhm



can examples ?


kmkmmm
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 06/14/2013 :  07:37:09  Show Profile  Reply with Quote

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


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000