Insert SQL Server Column does not receive value

Asked

Viewed 165 times

0

I’m trying to get the Insert in a simple table, but a field of it, it’s not saving the value I’m passing it, and the weird thing is that all the other columns get it right. Example

INSERT TabelaExemplo (id, nome, outroId) values (1,'Gabriela', 2)

It is successfully inserted, but the column outroID null appears when I give the select in this table. important to take into account that the column outroId is of type INT and accepts values null. But when passing values should persist the right data?

Other data in column given by sp_help

Column_name outroId
Type int    
Computed no
Length  4
Prec 10
Scale 0
Nullable yes
TrimTrailingBlanks  (n/a)
FixedLenNullInSource (n/a)  
Collation NULL

Does anyone have any idea why this is happening?

  • 1

    How are you running the code? That is, in what environment. // Is the id column primary key or Unique column? // Try repeating the command, but providing an id value that makes sure it is not in the table.

  • this other ID in practice is for reference in a certain way a history of an ID that has been changed, so it has to exist in the table. the first column ID, is a primart Key and Foreign key in another table. I’m doing this in a test environment.

  • 2

    There are triggers in this table ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.