Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

temp tables with UDF defaults

 
   Database Help (Home) -> Programming RSS
Next:  Latch / Wait Events  
Author Message
Dan Holmes

External


Since: May 23, 2008
Posts: 47



(Msg. 1) Posted: Thu Nov 12, 2009 11:21 am
Post subject: temp tables with UDF defaults
Archived from groups: microsoft>public>sqlserver>programming (more info?)

how do you get a temp table to use a udf in your db? I tried putting the databasename in front of dbo but it complained
about it. Does the function need to be created in tempdb too?


Create function mydate()
returns datetime
as
begin
declare @d datetime;
SET @d = getdate();
return @d;
end;

CREATE Table #t2
(
d Datetime NOT NULL DEFAULT (CONVERT(CHAR(Cool, dbo.mydate(), 112))
)

 >> Stay informed about: temp tables with UDF defaults 
Back to top
Login to vote
Uri Dimant

External


Since: Aug 24, 2003
Posts: 1744



(Msg. 2) Posted: Mon Nov 16, 2009 6:25 am
Post subject: Re: temp tables with UDF defaults [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Dan
You will need to process with a 'key-process' permanent table which has a
column as @@SPID to identify the session

If I remember well , Erland has a great article for the subject. Lookup his
website


"Dan Holmes" wrote in message

> how do you get a temp table to use a udf in your db? I tried putting the
> databasename in front of dbo but it complained about it. Does the
> function need to be created in tempdb too?
>
>
> Create function mydate()
> returns datetime
> as
> begin
> declare @d datetime;
> SET @d = getdate();
> return @d;
> end;
>
> CREATE Table #t2
> (
> d Datetime NOT NULL DEFAULT (CONVERT(CHAR(Cool, dbo.mydate(), 112))
> )

 >> Stay informed about: temp tables with UDF defaults 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Temp tables and SP - Hi, I have a StoredProcedure 'ProfitSP' in different databases and the ProfitSP is same in each database. If I execute ProfitSP as: <font color=purple> ; Exec DB1.dbo.ProfitSP @OrderStartDate, @OrderEndDate</font> it works fine! ...

Temp Tables and Joins - I'm trying to create a temp table and insert columns from two different tables into it using an outter join. I keep getting an "Invalid column name" error for the column coming from the joined table. Are there any potential complications I shou...

"connection" for temp tables - I thought I knew what "connection" meant, but now I guess i don't. Two books told me that temp tables were not destroyed until the "connection" ends. I created temp tables in one SQL script, and tried to build a view from them in a...

viewing #temp tables - I using .Net 2008 to troubleshoot my SQL Server stored procedures. It allows me to connect to a Sql Server database and step into the stored procs and troubleshoot. It is a very usefull tool. However, when doing that, I would like to be able to view..

limit on # of temp tables? - I have a script that creates several (4+) temp tables. However, when I run the script, it acts like the first two exist but the latter ones do not. I use the code SELECT TABLE_NAME FROM tempdb.INFORMATION_SCHEMA.TABLES WHERE [TABLE_NAME] LIKE '%#%'....
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]