none
Northwind sample database customerid primary key data RRS feed

  • Question

  • hi

    in database north wind i can not understand the customerid data which is presented with chracter  LIKE

    CUSTOMERID

    ALFKI

    ANATR

    ...

    ...

    so on

    -----------------------------------

    i want to primary key auto genrate the customerid in nchar(5), IS IT POSSIBLE. IF YES PLEASE HELP.

    OTHERWISE HOW CAN I CHANGE CUSTOMERID IN INTEGER IN FOLLOWING TABLE

    DBO.CUSTOMER

    DBO.Orders

    DBO.CustomerCustomerDemo

    -------------------------------------

    LAST QUESTION ABOUT DIAGRAM

    IN THIS DIAGRAM CUSTOMER PURCHASE AND SUPPLIER SALE EVERY PRODUCT IN CASH, BUT IN MY CASE CREDIT IS INVOLVE, HOW CAN I HANDLE, SOME TIME CUSTOMER PAY BILL INSTALLMENT, AND SOME TIME PAY THE ALL BILL

    AND SAME I DID WITH SUPPLIER.

    WHAT ARE CHANGES MAKE IN DATABASE TO HANDLE THE CREDIT PURCHASE AND SALE


    MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959

    Tuesday, September 17, 2019 6:47 PM

Answers

  • Hello,

    Two months ago you asked for information on the same database, I provided information and never heard back from you as to is my response resolved your question. So I hesitate to provide more information.

    I did provide you with a version of the database where customer identifier is auto incrementing so why are you not looking at that version?

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/f8d6d138-ab13-4e74-89d7-76584894a449/norwind-database-customer-id?forum=vbgeneral#f8d6d138-ab13-4e74-89d7-76584894a449


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by muhammadanzar Wednesday, September 18, 2019 10:03 AM
    Tuesday, September 17, 2019 7:31 PM
    Moderator
  • Hi,

    Take SQL Server as an example, how to set up CustomerId self-increment.

    In SQL SERVER, all columns of integer type can be defined as self-increasing columns, called "identification", which can be realized by setting "identification seed" and "identification increment".  

    Method 1:
    1. Select the table to be modified.
    2. Right-click mouse, design.
    3. Select the column (integer type). You can change nchar (5) to int.
    4. Set the logo to "True" (default to "False"), the logo Identity Increment and the logo Identity Seed (generally 1).

    When you insert a line, it automatically assigns values (1, 2, 3, 4 int...) from the beginning. 255).

    Method 2:
    ALTER TABLE [dbo]. [TableName] DROP COLUMN CustomerId
    ALTER TABLE [dbo]. [TableName] ADD CustomerId INT IDENTITY (1,1) NOT NULL

    Note: This only applies to the case of newly created tables. If the primary key has been used at this time,and  there are many data in the table, it is better not to use this method to delete the primary key, which will lead to data loss.

    Hope it will be helpful.

    Best Regards,

    Julie


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, September 18, 2019 4:20 AM
    Moderator

All replies

  • Hello,

    Two months ago you asked for information on the same database, I provided information and never heard back from you as to is my response resolved your question. So I hesitate to provide more information.

    I did provide you with a version of the database where customer identifier is auto incrementing so why are you not looking at that version?

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/f8d6d138-ab13-4e74-89d7-76584894a449/norwind-database-customer-id?forum=vbgeneral#f8d6d138-ab13-4e74-89d7-76584894a449


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by muhammadanzar Wednesday, September 18, 2019 10:03 AM
    Tuesday, September 17, 2019 7:31 PM
    Moderator
  • Hi,

    Take SQL Server as an example, how to set up CustomerId self-increment.

    In SQL SERVER, all columns of integer type can be defined as self-increasing columns, called "identification", which can be realized by setting "identification seed" and "identification increment".  

    Method 1:
    1. Select the table to be modified.
    2. Right-click mouse, design.
    3. Select the column (integer type). You can change nchar (5) to int.
    4. Set the logo to "True" (default to "False"), the logo Identity Increment and the logo Identity Seed (generally 1).

    When you insert a line, it automatically assigns values (1, 2, 3, 4 int...) from the beginning. 255).

    Method 2:
    ALTER TABLE [dbo]. [TableName] DROP COLUMN CustomerId
    ALTER TABLE [dbo]. [TableName] ADD CustomerId INT IDENTITY (1,1) NOT NULL

    Note: This only applies to the case of newly created tables. If the primary key has been used at this time,and  there are many data in the table, it is better not to use this method to delete the primary key, which will lead to data loss.

    Hope it will be helpful.

    Best Regards,

    Julie


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, September 18, 2019 4:20 AM
    Moderator