Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UDTs in temp table def

Status
Not open for further replies.

DougXP

Programmer
Sep 30, 2004
1
CH
Hi

When I try to create a temp table with columns of a user defined type I get an error: 2715 Can't find type...

I realise this is because the UDTs are not present in the tempdb and I don't want to create them there.

Is there a solution?
 
try building the temp table by using select into.

i.e if you have tableA with columns that are UDT, you can
run

select * into tempdb..tableB
from yourdb..tableA
where 0=1 -- false value here simply will cause
-- empty table structure to be created
-- and underlying type of UDT col from
-- original table will be used.
go
use tempdb
exec sp_help tableB
go
 
Actually in my previous post I should note it is better to use #tableB as opposed to tempdb..tableB. The former is truly a temp table, while the latter will remain in tempdb until you drop it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top