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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to use Getdate() and rand() functions

Author  Topic 

mdanwerali
Starting Member

30 Posts

Posted - 2002-10-30 : 03:55:24
Hi,

How to use Getdate() and rand() functions in a user defined functions.

for example:

Create FUNCTION Random(@intval int) RETURNS int
AS
Begin
DECLARE @counter int
Declare @outval int
SET @counter = @intval
BEGIN
select @outval = RAND(@counter)
END
End
GO


it is giving error :
Server: Msg 443, Level 16, State 1, Procedure Random, Line 8
Invalid use of 'rand' within a function.

Please help me in explaing me how to use system default functions in user defined functions.


thanks in advance

Md Anwer Ali

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-10-30 : 05:24:48
Double posted!!!!!

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=21134

Go to Top of Page
   

- Advertisement -