Gracias anticipadas
Eduardo
--
Salu2
-----------------------------------------
Microsoft MVP SQL Server
Culminis Speaker
INETA Speaker
------------------------------------------
"Eduardo" <edu...@clarion-spain.com> escribió en el mensaje
news:%23VzsYnc...@TK2MSFTNGP05.phx.gbl...
Puedes leer en los libros en linea que solo se permiten valores constantes
como cadena de caracteres, funciones de sistema como getdate() o valor NULL.
Si usas cualquier expresion que referencie otra columna, incluyendo una
funcion de usuario, SQL Server dara error.
Ejemplo:
create function dbo.f1 (
@i int
)
returns varchar(50)
as
begin
return (select c2 from dbo.t1 where c1 = @i)
end
go
-- SQL Server dara un error en esta sentencia
-- Server: Msg 128, Level 15, State 1, Line 5
-- The name 'c1' is not permitted in this context.
-- Only constants, expressions, or variables allowed here. Column names are
not permitted.
create table dbo.t1 (
c1 int not null,
c2 varchar(50),
c3 varchar(50) default (dbo.f1(c1))
)
go
drop function dbo.f1
go
drop table dbo.t1
go
AMB