Mssql error 1213/9/2024 ![]() It’s also possible to use the asterisk ( *) wildcard in the SELECT list. However, this would depend on whether or not we have any NOT NULL constraints on the destination table. If we didn’t want that column to be inserted, then we should have removed it from the INSERT altogether. The previous example obviously assumes that I wanted to insert the extra column. INSERT INTO OrdersLatest (Īll I did was add the OrderDesc column to the SELECT list. In this case, I specify three columns in my INSERT, but I only select two columns in my SELECT list. The number of SELECT values must match the number of INSERT columns. The select list for the INSERT statement contains fewer items than the insert list. Result: Msg 120, Level 15, State 1, Line 1 Here’s an example of code that causes this error. Simply make sure the number of columns match between your INSERT and SELECT list. To be more specific, it happens when you use a SELECT list in your INSERT statement, but the SELECT list doesn’t return as many columns as you’re specifying with the INSERT. SQL Server error 120 occurs when you don’t specify enough columns in your INSERT list when using a SELECT list for the values to insert.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |