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

  • Home
  • SEARCH
  • 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 8861899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:35:48+00:00 2026-06-14T15:35:48+00:00

In my code i tend to use a lot of Flags enums that correspond

  • 0

In my code i tend to use a lot of Flags enums that correspond to a DB table that contain all their behavioral properties.
This way the behavioral properties can be use both in SP and in C# code that uses the enum.

My problem is with Enums that have the Flags attribute attached to them.

Is there a way to automatically generate powers of 2 as identity column (or as a sequence) for such tables?

PS: currently i manually place the code in small table – or programmatically in tables that change over time – i prefer to do it automatically

  • 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-06-14T15:35:50+00:00Added an answer on June 14, 2026 at 3:35 pm

    As far as I know, the answer is NO. Identity is meant to increment by the value of seed you specified which is 1 by default. But you can have identity in multiple of 2. e.g. 2,4,6,8,10

     id INT identity(2, 2)   -- starts at 2, increments by 2
    

    If you want something else you might need to implement your own.

    Computed Columns

    create table t
    (
       id int identity, 
       power_id as power(2, id), 
       name varchar(50)
    )
    
    Results
    
    ID  POWER_ID    TEXT
    -------------------------------
    1   2           SHORT      ----2^1
    2   4           MEDIUM     ----2^2
    3   8           LONG       ----2^3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tend to use enums to create mini data tables all over my code.
I had this working in an old code that I didn’t end up using...
Inside the Rails code, people tend to use the Enumerable#inject method to create hashes,
I have a wordpress site in which we tend to use a lot of
I tend to use Regionerate quite extensively for reorganizing my code files. My only
Most of our projects use a lot of common code. We are (finally) moving
So, I like to use TextWrangler for editing code in OSX, and I tend
In new C++ code, I tend to use the C++ iostream library instead of
When debugging web sites that I'm working on, I tend to use Attach to
How would you fix this code? template <typename T> void closed_range(T begin, T end)

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.