DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Create A Udf That Returns A Random Number.

10.26.2008
| 3265 views |
  • submit to reddit
        // description of your code here

create view vRandom
as
	select rand() * 10 r
GO 
CREATE FUNCTION udfGetRandomNumber()
returns int
as
begin
	return (select r from vRandom);
end
go
select dbo.udfGetRandomNumber() from sysobjects