Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

temp tables with UDF defaults

0 views
Skip to first unread message

Dan Holmes

unread,
Nov 12, 2009, 11:21:39 AM11/12/09
to
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(8), dbo.mydate(), 112))
)

Uri Dimant

unread,
Nov 16, 2009, 5:38:21 AM11/16/09
to
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" <dan.h...@routematch.com> wrote in message
news:eDpu3Q7Y...@TK2MSFTNGP02.phx.gbl...

0 new messages