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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:50:54+00:00 2026-06-07T07:50:54+00:00

I just started working with SQL Server and I have some troubles with adding

  • 0

I just started working with SQL Server and I have some troubles with adding values to a table with a column of type uniqueidentifier.

The table consists of:

ID (uniqueidentifier), CODE (nchar(5)), COUNTRY_CODE(nchar(2)), NAME(nchar30)  

I tried adding values from Excel and CSV files, basically they look like this:

DEBE,DE,Berlin

I could not load it, always have some errors with this ID field.

When i try to add values manually like:

INSERT INTO [Portfolio].[dbo].[Regions](CODE, COUNTRY_CODE, NAME) 
VALUES ('DEBE', 'DE', 'Berlin');

It says:

Cannot insert the value NULL into column ‘ID’, table
‘Portfolio.dbo.Regions’; column does not allow nulls. INSERT fails.

Of course when I add an id column and a number, I get info that int is incompatible with uniqueidentifier.

I even tried creating a temp table (with id as an INT instead of uniqueidentifier) and copying values from it into this (without ID column, its supposed to generate automatically)

Only thing I can think of is that ID column is not creating values for it automatically and I don’t know how to solve this. Can anyone help?

  • 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-07T07:50:55+00:00Added an answer on June 7, 2026 at 7:50 am

    Uniqueidentifier is a special type you can use to generate GUID. Is 16 byte long and is not incremented automatically as the Identity columns. You need to use Convert or Cast clause in order to get the correct uniqueidentifier from a varchar, if it exceeds the 16bytes it will be truncated.

    Use NewID() to generate a new uniqueidentifier.

    Maybe this link can help you

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

Sidebar

Related Questions

I've just now started working with SQL; I need to represent some information in
I've just started working with SQL Server for the first time and I'm having
I have just started working with a new company in a very small IT
i have just started using visual studio 2008.I am working on c#. I want
I've just started using SQL, so that have no idea how t work with
I just started working with Yaws to try to create some simple RESTful web
I've been working with Microsoft SQL Server with many years now but have only
I just started working with SQL and now what I need is to make
I am new to swing and I have just started working on it as
Hi i'm working on an application and I've just started toying with SQL I've

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.