Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6650141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:51:28+00:00 2026-05-26T00:51:28+00:00

CREATE VIEW [dbo].[MyView] ([ID],[VisitDate],[StartDate] ,[EndDate]) WITH SCHEMABINDING AS SELECT id, VisitDate,dateadd(dd,-10,VisitDate)persisted, dateadd(dd,10,VisitDate)persisted FROM dbo.Visits

  • 0
CREATE VIEW [dbo].[MyView] ([ID],[VisitDate],[StartDate] ,[EndDate])
WITH SCHEMABINDING  

    AS
    SELECT     id, VisitDate,dateadd(dd,-10,VisitDate)persisted,
       dateadd(dd,10,VisitDate)persisted
    FROM         dbo.Visits

I have a non-clustered index on ID and VisitDate.I wantd to know if the computed columns StartDate and Enddate is persisted or is it calculated runtime when view is referenced

EDIT:what if i have a unique clustered index on ID and VisitDate.In that case will these columns become persisted?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:51:29+00:00Added an answer on May 26, 2026 at 12:51 am

    In your view, the values are calculated at runtime. The word “persisted” there is treated as the column name, not a special keyword.

    If you want to create calculated columns that are persisted, you need to do so as part of the table definition, either in the CREATE TABLE statement, or as an UPDATE TABLE statement. You could also consider using an indexed view.

    See the documentation for more details:

    • Computed Columns
    • Creating Indexed Views
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

consider this sql CREATE VIEW [dbo].[MyView1] ([ID],[VisitDate],[StartDate] ,[EndDate],[MyCount]) WITH SCHEMABINDING AS SELECT id, VisitDate,dateadd(dd,-10,VisitDate),dateadd(dd,10,VisitDate),
I have created an indexed view: CREATE VIEW LogValueTexts WITH SCHEMABINDING AS SELECT ISNULL(LRVS_SLOG_ID*256+LRVS_IDX,0)
Let's say you have a view: CREATE VIEW dbo.v_SomeJoinedTables AS SELECT a.date, a.Col1, b.Col2,
I have a view name vw_AllJobsWithRecruiter. ALTER VIEW dbo.vw_AllJobsWithRecruiter AS SELECT TOP(SELECT COUNT(iJobID_PK) FROM
If i have a view that generates multiple columns: CREATE VIEW dbo.foo AS SELECT
CREATE VIEW View1 AS SELECT Col1, Col2, dbo.fn1(col2) as Col3 FROM TestTable /* --Instead
My create view code like this create VIEW [dbo].[vw_test] AS SELECT 'B' AS rtype,
This is my query, CREATE VIEW employee_vu AS( SELECT employee_id,last_name employee,department_id FROM employees); I
This code does not work, returning the error: BEGIN CREATE VIEW [dbo].[dummy] AS SELECT
I have a view that I want to create a table from in SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.