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
 Creating temp tables

Author  Topic 

Trininole
Yak Posting Veteran

83 Posts

Posted - 2012-05-08 : 09:31:57
How do i create 2 temp tables? And then use those same two temp tables to produce results that are unduplicated? What would be the syntax for that?

Roger DeFour

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-05-08 : 11:04:05
Your question is hard to answer because it is rather vague. You can create a temp table using the create table command (http://msdn.microsoft.com/en-us/library/ms174979.aspx ) in T-SQL. For example
CREATE TABLE #tmp1(col1 int, col2 char(32));
As to producing results, that depends on what your tables are, what the data is etc. Take a look at Brett's blog here - that may help you formulate the question more precisely
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-08 : 11:06:00
quote:
Originally posted by Trininole

How do i create 2 temp tables? And then use those same two temp tables to produce results that are unduplicated? What would be the syntax for that?

Roger DeFour


You can probably show us what you meant by means of sample data. Explain what according to you are duplicates and how you would like to eliminate them
As far as creating temp table goes it will be like

CREATE TABLE #tablename
(
column1 datatype nullability...,
...
)



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -