Article View: comp.databases.ms-sqlserver
Article #98Re: create unique index to allow null values
From: Erland Sommarskog
Date: Wed, 16 Apr 2003 07:32
Date: Wed, 16 Apr 2003 07:32
42 lines
3354 bytes
3354 bytes
[posted and mailed, please reply in news] [Note: I've set followups to comp.databases.ms-sqlserver only.] ^-^ (mortalnightmare@hotmail.com) writes: > I have a table called dc_weighbridge_MAIN that that has to have an > unique id called [ticket] but "ticket" also has to allow null values... > so i set the ticket field to allow null fields, but to check for > duplicate entries I created a view called "check_duplicates" wich a form > will be based on as soon as this function is working.... in the view I > added all the records but made "ticket" an unique index... > > Now when I try to delete or add any records in my table (not even using > the view) I get the error: DELETE failed because the following SET > options have incorrect settings: 'ARITHABORT' In able to access an indexed view, there are seven settings that must apply. All the following must be on: ANSI_NULLS (P), ANSI_WARNINGS (R), ANSI_PADDING (C), QUOTED_IDENTIFIER (P), ARITHABORT (R), CONCAT_NULL_YIELDS_NULL (R). And this setting must be OFF: NUMERIC_ROUNDABORT (R). The parantheses refers to where you control these settings. R is run-time. P means that the setting is saved with the stored procedure and C that it is saved by table column. The default for these settings vary with context. With DB-Library all settings are OFF by default. With OLE DB and ODBC all settings are ON by default, save NUMERIC_ROUNDABORT and ARITHABORT. However, when you use OSQL or Enterprise Manager, also QUOTED_IDENTIFIER is OFF. What happens when the indexed view cannot be used, depends on how you try to use it. If it is just a SELECT statement that can be resolved in other way, you will only get another query plan (which is probably a less good one). If you try to update through the view, you get an error message. -- Erland Sommarskog, SQL Server MVP, sommar@algonet.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
Technical Details
Message-ID:
<Xns935F60EFB2B46Yazorman@127.0.0.1>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news.algonet.se!newsfeed1.telenordia.se!algonet!news2.tninet.se!not-for-mailReferences:
<b7ito9$5kt$1@ctb-nnrp2.saix.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1135f7,32f0907ad6165bb4 X-Google-Attributes: gid1135f7,public X-Google-Thread: ff490,32f0907ad6165bb4 X-Google-Attributes: gidff490,public X-Google-Thread: 10b4ec,32f0907ad6165bb4 X-Google-Attributes: gid10b4ec,public X-Google-Thread: 104de1,32f0907ad6165bb4 X-Google-Attributes: gid104de1,public X-Google-ArrivalTime: 2003-04-16 00:31:37 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news.algonet.se!newsfeed1.telenordia.se!algonet!news2.tninet.se!not-for-mail From: Erland Sommarskog <sommar@algonet.se> Newsgroups: comp.databases.ms-sqlserver,cz.comp.microsoft.sql,microsoft.public.sqlserver.tools,microsoft.public.za.sql Subject: Re: create unique index to allow null values Followup-To: comp.databases.ms-sqlserver Date: Wed, 16 Apr 2003 07:32:49 +0000 (UTC) Organization: BRF Beckasinen 13 Lines: 42 Sender: sommar@algonet.invalid Message-ID: <Xns935F60EFB2B46Yazorman@127.0.0.1> References: <b7ito9$5kt$1@ctb-nnrp2.saix.net> NNTP-Posting-Host: kairos.algonet.se X-Trace: green.tninet.se 1050478369 11881 213.150.135.237 (16 Apr 2003 07:32:49 GMT) X-Complaints-To: abuse@telenordia.se NNTP-Posting-Date: Wed, 16 Apr 2003 07:32:49 +0000 (UTC) User-Agent: Xnews/5.04.25