Tag Info

New answers tagged

0

If you query the table you're inserting into inside a trigger on that same table, you are likely to get "ORA-04091: table name is mutating, trigger/function may not see it." error. Check constraints cannot contain subqueries. Therefore your best option is to encapsulate logic for inserting data into a stored procedure and use that procedure instead of direct ...


11

As alluded to by @Souplex in the comments one possible explanation might be if this column is the first NULL-able column in the non clustered index it participates in. For the following setup CREATE TABLE Foo ( A UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY, B CHAR(1) NOT NULL DEFAULT 'B' ) CREATE NONCLUSTERED INDEX ix ...


4

It will definitely re-create the non clustered index and not just update metadata. This is tested on SQL 2014 and should really not be tested on a production system CREATE TABLE [z]( [a] [int] IDENTITY(1,1) NOT NULL, [b] [int] NOT NULL, CONSTRAINT [c_a] PRIMARY KEY CLUSTERED ([a] ASC)) go CREATE NONCLUSTERED INDEX [nc_b] on z (b asc) GO insert ...


0

Access doesn't support the IF EXISTS syntax in queries; I think your error is coming from that. It's also very difficult to do any sort of procedural logic using Access SQL. Your alternatives are to run the ALTER TABLE statement and handle the error elsewhere or use VBA to conditionally run the statement.


-4

If you only need to eliminate the last rows which have not followed the incremental value of an identity field, there is an easy and safe way: first delete the last record(s) which have 'jumped' change the data type of your Identity Field (from int to bigint or vice versa) save the table add a new record, and check it assigns the number of the highest ...



Top 50 recent answers are included