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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:59:15+00:00 2026-06-13T00:59:15+00:00

In previous versions of Visual studio there was a way to build DB using

  • 0

In previous versions of Visual studio there was a way to build DB using diagrams.

In 2012 they took out that possibility.

I need to create script which creates table for category tree.

    CREATE TABLE [dbo].[Categories]
(
    [Id] INT NOT NULL PRIMARY KEY IDENTITY, 
    [Name] NVARCHAR(50) NOT NULL, 
    [ParentId] INT NOT NULL DEFAULT 0, 
    [FK_Parent] int FOREIGN KEY ([ParentId]) REFERENCES [Categories]([Id]) NOT NULL
)

If I create table like this, I cannot add top level records.

  • 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-13T00:59:16+00:00Added an answer on June 13, 2026 at 12:59 am

    Define top-level records as having a NULL FK_Parent. Just change your definition to allow nulls.

    CREATE TABLE [dbo].[Categories]
    (
        [Id] INT NOT NULL PRIMARY KEY IDENTITY, 
        [Name] NVARCHAR(50) NOT NULL, 
        [ParentId] INT NOT NULL ,
        ---llow NULL FK_Parent for top-level
        CONSTRAINT [FK_Parent] FOREIGN KEY ([ParentId]) REFERENCES [Categories]([Id])
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i remember that previous versions of visual studio contained a converter, that automatically attempt
In previous versions of Visual Studio, there was a single entry point to an
I've started to use Visual Studio 2012 and there is one feature that really
in previous versions of Visual Studio, you could collapse the html blocks, but that
In previous versions of Visual Studio I remember I saw the error code/number in
In previous versions of Excel there was a registry entry that you could create
(I'm using Visual Studio 2008, though I remember having similar problems with older versions
I know that this was an advanced compiler option in previous versions of Visual
I have a .lib file created with previous versions of visual studio, perhaps 2003
Is there a way to transfer a Visual Studio project to the MonoDevelop environment?

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.