SCHEMABINDING with a Query...
***Table***
CREATE TABLE Sampletbl ( col1 DATETIME )
***Data***
INSERT INTO Sampletbl
VALUES ( GETDATE() + 1 )
***Function***
CREATE FUNCTION SampleFunction ( )
RETURNS DATETIME
WITH SCHEMABINDING
AS
BEGIN
DECLARE @t DATETIME
SELECT @t = col1
FROM dbo.Sampletbl
RETURN @t
END
***Table***
CREATE TABLE Sampletbl ( col1 DATETIME )
***Data***
INSERT INTO Sampletbl
VALUES ( GETDATE() + 1 )
***Function***
CREATE FUNCTION SampleFunction ( )
RETURNS DATETIME
WITH SCHEMABINDING
AS
BEGIN
DECLARE @t DATETIME
SELECT @t = col1
FROM dbo.Sampletbl
RETURN @t
END