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 8784293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:03:04+00:00 2026-06-13T21:03:04+00:00

While creating a table I have to use the datatype SET , but it

  • 0

While creating a table I have to use the datatype SET, but it looks like there is no datatype SET in SQL Server. I was looking on the Microsoft’s website and those are the datatypes that it supports: http://msdn.microsoft.com/en-us/library/ms187752.aspx

Which one should I use to replace the SET?

I have used SET in MySQL database like this:

CREATE TABLE IF NOT EXISTS `configurations` (
`index` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`configDuration` int(5) NOT NULL,
`configDurationPerspective` set('list_this_day','list_remaining') NOT NULL,
PRIMARY KEY (`index`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

And then when I insert data into the table it looks like this:

INSERT INTO 'configurations' (index, user_id, configDuration, configDurationPerspective) VALUES (1, 1, 2, 'list_this_day');

Never mind the quotes. Something messed up while pasting the code.

Now I want to do the same thing, but in SQL Server.

  • 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-13T21:03:05+00:00Added an answer on June 13, 2026 at 9:03 pm

    You’d either have to use separate bit fields (one column with bit datatype per value) or you’d pack the values into a column with a integer datatype. If you’d use integer you’d have to use t-sql bitwise operators to read and write the values.

    If you use bitwise operators you’ll only get one column
    The create table statement should look like this:

    CREATE TABLE configurations(
    [index] int NOT NULL IDENTITY (1,1) PRIMARY KEY,
    user_id int NOT NULL,
    configDuration int  NOT NULL,
    configDurationPerspective int NOT NULL,
    )
    

    And then you’d have to insert values that are possible to bitmask like 1,2,4,8,16,32 into configDurationPerspective

    INSERT INTO 'configurations' (index, user_id, configDuration, configDurationPerspective) VALUES (1, 1, 2, 'list_this_day');
    

    would translate to

    INSERT INTO 'configurations' (index, user_id, configDuration, configDurationPerspective) VALUES (1, 1, 2, 1);
    

    And

    INSERT INTO 'configurations' (index, user_id, configDuration, configDurationPerspective) VALUES (1, 1, 2, 'list_remaining');
    

    would translate to

    INSERT INTO 'configurations' (index, user_id, configDuration, configDurationPerspective) VALUES (1, 1, 2, 2);
    

    and selecting could look like:

    select  [index], configDuration,
    case when configDurationPerspective & 1 > 0 then 'list_this_day' else '' end
     + case when configDurationPerspective & 2 > 0 then 'list_remaining' else '' end as configDurationPerspective
     from configurations
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problems with CSS. The table is creating white border and I do
while creating a thread in java, there is two ways such as Extending threads
I have a table that I'm creating in code behind with the final column
I have been given the task of creating a sql database and creating a
I've been fighting this for a while, seems I'm close but not quite there.
I have one question that if we are creating any table in database i.e.
I have a page that is creating dynamically created rows in a table with
I got an error while creating a table in php with mysql database, and
I'm a newbie to the use of SQL and databases; my apps have stayed
While creating the setup for VB.net application I am getting the following warning: Warning

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.