Note that there are some explanatory texts on larger screens.

plurals
  1. POComputed columns sometimes missing from SELECT *
    primarykey
    data
    text
    <p>In SQL Azure, I have a table more or less set up like this, with two computed columns (<code>IsExpired</code> and <code>IsDeadlineExpired</code>) that simply compare non-nullable datetime columns to the current time:</p> <pre><code>CREATE TABLE [dbo].[Stuff] ( [StuffId] int NOT NULL IDENTITY(1,1), [Guid] uniqueidentifier NOT NULL, [ExpirationDate] datetime NOT NULL, [DeadlineDate] datetime NOT NULL, [UserId] int NOT NULL, [IsExpired] AS CAST((CASE WHEN [ExpirationDate] &lt; GETUTCDATE() THEN 1 ELSE 0 END) AS bit), [IsDeadlineExpired] AS CAST((CASE WHEN [DeadlineDate] &lt; GETUTCDATE() THEN 1 ELSE 0 END) AS bit), CONSTRAINT [PK_StuffId] PRIMARY KEY ([StuffId]), CONSTRAINT [UNQ_Guid] UNIQUE([Guid]), ) GO </code></pre> <p>I have a stored procedure with several result sets, one of which pulls:</p> <pre><code>SELECT * FROM [dbo].[Stuff] WHERE [Guid] = @guid </code></pre> <p>I've recently noticed error logs indicating that sometimes when the result set is read with <code>SqlDataReader</code>, <code>SqlDataReader.GetOrdinal("IsExpired")</code> fails with <code>IndexOutOfRangeException</code>. I know the preceding columns work fine even in those cases, since they're read in preceding lines of code with no errors. I also believe the result sets from the procedure are in proper sequence since they don't share column names (otherwise reading the earlier columns would similarly fail).</p> <p>Also: most of the time everything seems to work perfectly.</p> <p>Can this somehow be attributed to Azure transient faults?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload