Hi, I have generated a script for a table with data. When i execute the script which has create table statement and insert statement, i end up getting error like missing column at insert statement.I went through the table and came to know that there is one column with datatype nvarchar(26) is not added to the table. I even tried to execute only create table statement with all columns but still cannot fine the one column in the table. How to resolve this?
Here is the script, i have some 58 columns and in between one of the column is getting missed which has nvarchar(26) datatype, This script i have generated using generate script wizard with data option true. ` SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[table]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[table]( [ID] [varchar](27) NULL, [GUID] [nvarchar](36) NULL, [LastName] [nvarchar](50) NULL, [FirstName] [nvarchar](50) NULL, [BadgeNumber] [nvarchar](14) NULL, [Description] [nvarchar](100) NULL, . . . . . . . . ) ON [PRIMARY] END GO SET ANSI_PADDING OFF GO `
Can you modify the CREATE TABLE script manually to add the column in question? If you do this, does the column still come up missing? If so, you have identified a major bug in SQL Server. Is it possible that the INSERT statement just has the wrong column name? A typo seems like a more likely answer.