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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:22:38+00:00 2026-06-08T17:22:38+00:00

I have the schema below : I tried to create a view and did

  • 0

I have the schema below : enter image description here

I tried to create a view and did everything to get IDStore_CardStore column NOT NULL in order to make it as the primary key in me EF entity but no success:
My aim is to select everything in the table StockCard even if it dosen’t exist in StockCardStores but i need to keep IDStore_CardStore not null and unique

SELECT  ISNULL(dbo.StockCardsStores.IDStore_CardStore, NEWID()) AS IDStore_CardStore ,
        NULLIF(dbo.StockCard.IDStockCardIndex, NEWID()) AS IDStockCardIndex ,
        dbo.Stores.StoreName ,
        dbo.StockCardsStores.IDPurchaseInvoice ,
        NULLIF(dbo.StockCard.Designation,'')
FROM    dbo.Stores
        INNER JOIN dbo.StockCardsStores ON dbo.Stores.IDStore = dbo.StockCardsStores.IDStore
        RIGHT OUTER JOIN dbo.StockCard ON dbo.StockCardsStores.IDStockCardIndex = dbo.StockCard.IDStockCardIndex

Is there any other workaround !

  • 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-08T17:22:39+00:00Added an answer on June 8, 2026 at 5:22 pm

    I think IDStore_CardStore already can’t be null, because it’s primary key in StockCardStores table. Maybe the problem is that IDStore_CardStore could have duplicated values in your view, making imposible to be the Primary Key of the view.

    I don’t know your requirements, but uou can Fake a Primary key for your view making something like this in the query:

    SELECT  ROW_NUMBER() OVER (ORDER BY dbo.StockCardsStores.IDStore_CardStore DESC) AS Id_PK, ISNULL(dbo.StockCardsStores.IDStore_CardStore, NEWID()) AS IDStore_CardStore ,
            NULLIF(dbo.StockCard.IDStockCardIndex, NEWID()) AS IDStockCardIndex ,
            dbo.Stores.StoreName ,
            dbo.StockCardsStores.IDPurchaseInvoice ,
            NULLIF(dbo.StockCard.Designation,'')
    FROM    dbo.Stores
            INNER JOIN dbo.StockCardsStores ON dbo.Stores.IDStore = dbo.StockCardsStores.IDStore
            RIGHT OUTER JOIN dbo.StockCard ON dbo.StockCardsStores.IDStockCardIndex = dbo.StockCard.IDStockCardIndex
    

    And then ID_PK can be the PK of he view in EF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

edit: my table schema below is poorly normalized as suggested and I have revamped
I have two tables names book_list and book_category . Schema is like below: book_list
I have a schema design that looks like this: Table: User Row Column Family
I have followed the instructions at http://www.javacodegeeks.com/2011/01/advanced-smartgwt-tutorial-part-1.html and tried to create a simple screen
I have flat file schema (description below), I am getting flat file(description below) through
I have below XAML code : <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml DataContext={Binding RelativeSource={RelativeSource Self}} WindowStartupLocation=CenterScreen
I have a table which have schema like this id name 1 jack 2
I know that I should have schema of a table before calling NewRow method
i have this schema: <div id=container> <div id=content>some text</div> <footer> my footer things </footer>
I have xsd schema file which I can't change. Here is an excerpt that

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.