Sunday, February 12, 2012

Can't index functinon-based column

Hello, I am trying to add an index to a column based on a formula that
is a function. When I try to do so, I get the error:
'Line' table
- Unable to create index 'IX_Line_LineText'.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot
create index. Object 'fn_GenerateLineText' was created with the
following SET options off: 'ANSI_NULLS.'.
But when I created the function, the top part looks like this, so I am
by the message:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE FUNCTION dbo.fn_GenerateLineText
(
@.LaborLineId int
)
***
I have to index this column. How can I do it?
-KJYou'll need to ensure that
SET ANSI_NULLS ON
when you create the underlying table
Also I believe you need "with schemabinding" option for your function

No comments:

Post a Comment