October 22, 2010 at 2:21 pm
SELECT rf.ContainerNo,rf.BookNo,BC.seal1No,BC.tareweight as tareweight,
BC.cargoweight as cargoweight,BC.weightunit into #tempops
FROM operationdetail rf (Nolock)
INNER JOIN BL (Nolock) ON BL.book_no=rf.BookNo
INNER JOIN BL_cargo BC(Nolock) ON BC.BL_NO=BL.BL_NO and BC.eqpid=rf.ContainerNo
WHERE BL.status <>'v' AND rf.reftype='B'
SELECT rf.ContainerNo,rf.BookNo,BC.seal1No,BC.tareweight as tareweight,
BC.cargoweight as cargoweight,BC.weightunit into #tempops1
FROM operationdetail rf (Nolock)
INNER JOIN combined_master cm (Nolock) ON cm.Bookno=rf.BookNo
INNER JOIN BL (Nolock) ON BL.bl_no=cm.nominated_bl
INNER JOIN BL_cargo BC(Nolock) ON BC.BL_NO=BL.BL_NO and BC.eqpid=rf.ContainerNo
WHERE BL.status <>'v' AND rf.reftype='B'
I have 2 temptable
1.#tempops
2.#tempops1
i want add( combine) two temp table with out using UNION ,
1 st temptable have 10 recods,
2 nd temptable have 20 records,
i want get 30 records in one temp table ,how to do ,
can any one advise me please ???
October 22, 2010 at 2:30 pm
s.chandrahasan (10/22/2010)
SELECT rf.ContainerNo,rf.BookNo,BC.seal1No,BC.tareweight as tareweight,BC.cargoweight as cargoweight,BC.weightunit into #tempops
FROM operationdetail rf (Nolock)
INNER JOIN BL (Nolock) ON BL.book_no=rf.BookNo
INNER JOIN BL_cargo BC(Nolock) ON BC.BL_NO=BL.BL_NO and BC.eqpid=rf.ContainerNo
WHERE BL.status <>'v' AND rf.reftype='B'
SELECT rf.ContainerNo,rf.BookNo,BC.seal1No,BC.tareweight as tareweight,
BC.cargoweight as cargoweight,BC.weightunit into #tempops1
FROM operationdetail rf (Nolock)
INNER JOIN combined_master cm (Nolock) ON cm.Bookno=rf.BookNo
INNER JOIN BL (Nolock) ON BL.bl_no=cm.nominated_bl
INNER JOIN BL_cargo BC(Nolock) ON BC.BL_NO=BL.BL_NO and BC.eqpid=rf.ContainerNo
WHERE BL.status <>'v' AND rf.reftype='B'
I have 2 temptable
1.#tempops
2.#tempops1
i want add( combine) two temp table with out using UNION ,
1 st temptable have 10 recods,
2 nd temptable have 20 records,
i want get 30 records in one temp table ,how to do ,
can any one advise me please ???
Change the 2nd query to:
INSERT INTO #tempops
SELECT rf.ContainerNo,rf.BookNo,BC.seal1No,BC.tareweight as tareweight,
BC.cargoweight as cargoweight,BC.weightunit FROM operationdetail rf (Nolock)
INNER JOIN combined_master cm (Nolock) ON cm.Bookno=rf.BookNo
INNER JOIN BL (Nolock) ON BL.bl_no=cm.nominated_bl
INNER JOIN BL_cargo BC(Nolock) ON BC.BL_NO=BL.BL_NO and BC.eqpid=rf.ContainerNo
WHERE BL.status <>'v' AND rf.reftype='B'
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
October 22, 2010 at 2:30 pm
Rather than using SELECT INTO for your second statement, why not just use INSERT INTO?
Edit: looks like Alvin and I are operating on the same wavelength today! 🙂
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
October 22, 2010 at 2:36 pm
How about
SELECT your_statement1
UNION ALL
SELECT your_statement2
?
Side note: you don't really need to store it in two temp tables before the UNION operation (as long as you don't need those separate tables for any other processing...)
October 22, 2010 at 2:39 pm
Ray K (10/22/2010)
Rather than using SELECT INTO for your second statement, why not just use INSERT INTO?Edit: looks like Alvin and I are operating on the same wavelength today! 🙂
I feel sorry for you Ray if you're operating on the same wavelength as me. 😀
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
October 22, 2010 at 2:53 pm
Alvin Ramard (10/22/2010)
Ray K (10/22/2010)
Rather than using SELECT INTO for your second statement, why not just use INSERT INTO?Edit: looks like Alvin and I are operating on the same wavelength today! 🙂
I feel sorry for you Ray if you're operating on the same wavelength as me. 😀
That's funny . . . my wife says the same thing to me! :hehe:
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
October 23, 2010 at 8:31 am
Dear All,
Thanks a lot Alvin Ramard.............:-)
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply