Skip to content
Advertisement

Failed to execute query. Error: String or binary data would be truncated in table xdbo.user_info’, column ‘uid’

I have problem inserting values in my SQL server database on Azure, I am getting the following error:

I don’t understand where I am wrong, I just created the server, and I am trying to experiment but cant fix this.

Creating the table works fine, the only thing that doesn’t work is the second command INSERT

Advertisement

Answer

I suspect that the reason is that you haven’t defined a lenght for varchar and it defaults to 1 as length. Therefore your value gets truncated.

Set a varchar length to something like varchar(200) and you should be good to go.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement