How to name table-variable function unique constraint?
8
votes
1
answer
1597
views
I am renaming some unique constraints to match our database objects naming convention. Strangely, there are several multi-line table valued function which returned table has unique constraints as follows:
CREATE FUNCTION [dbo].[fn_name] (...)
RETURNS @Result
TABLE
(
ID BIGINT PRIMARY KEY,
...
RowNum BIGINT UNIQUE
)
BEGIN
...
RETURN
END
GO
I have try to name it like this, but is not working:
CREATE FUNCTION [dbo].[fn_name] (...)
RETURNS @Result
TABLE
(
ID BIGINT PRIMARY KEY,
...
RowNum BIGINT
,CONSTRAINT UC_fn_name_RowNum UNIQUE([RowNum])
)
BEGIN
...
RETURN
END
GO
Is it possible to set the name of a unique constraint when it is part of table variable function definition?
Asked by gotqn
(4348 rep)
Dec 7, 2015, 01:56 PM
Last activity: Mar 11, 2019, 08:27 AM
Last activity: Mar 11, 2019, 08:27 AM