Tom Moreau
3/8/2007 11:44:00 PM
Not so:
create function dbo.fx
(
@a int
, @b int
)
returns bit
as
begin
if (@a > @b)
return cast (1 as bit)
return cast (0 as bit)
end
go
create table t
(
ID int primary key
, x int not null
, y int not null
, check (dbo.fx (x, y) = 1)
)
go
drop table t
go
drop function fx
--
Tom
----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
.
"John Grandy" <johnagrandy-at-gmail-dot-com> wrote in message
news:OkGqlodYHHA.4440@TK2MSFTNGP03.phx.gbl...
Apparently it is not possible to call UDFs from constraints.
Or is there a clever workaround ... ?