'SQL Server: Invalid Column Name. Msg 207
I can't seem to figure out why I am getting this error. I have a column named 'strSSN' in my Customers table. I tried inserting dummy data into my database and keep getting:
sg 207, Level 16, State 1, Line 299
Invalid column name 'strSSN'.
Below is my table:
CREATE TABLE TCustomers (
intCustomerID INTEGER NOT NULL
,strFirstName VARCHAR(255) NOT NULL
,strLastName VARCHAR(255) NOT NULL
,strAddress VARCHAR(255) NOT NULL
,intCityID INTEGER NOT NULL --FK .
,intStateID INTEGER NOT NULL --FK .
,strZip VARCHAR(255) NOT NULL
,strPhoneNumber VARCHAR(255) NOT NULL
,strEmail VARCHAR(255) NOT NULL
,dtmDateOfBirth DATETIME NOT NULL
,strSSN VARCHAR(25) NOT NULL
,intGenderID INTEGER NOT NULL --FK .
,intMaritalStatusID INTEGER NOT NULL --FK .
,intIncomeRangeID INTEGER NOT NULL --FK .
,intRiskAssessmentID INTEGER NOT NULL --FK .
,CONSTRAINT TCustomers_PK PRIMARY KEY ( intCustomerID )
)
and here is the dummy data:
INSERT INTO TCustomers (intCustomerID, strFirstName, strLastName, strAddress, intCityID, intStateID, strZip, dtmDateOfBirth, intGenderID, strPhoneNumber, strEmail, strSSN, intMaritalStatusID, intIncomeRangeID, intRiskAssessmentID)
VALUES (1, 'James', 'Jones', '321 Elm St.', 1, 1, '45201', '1/1/1997', 1, '513-556-2150', '[email protected]', '245-67-3456', 1, 3, 2)
,(2, 'Sally', 'Smith', '987 Main St.', 3, 1, '45218', '12/1/2002', 2, '513-889-6587', '[email protected]', '658-45-8720', 2, 2, 4)
,(3, 'Jose', 'Hernandez', '1569 Windisch Rd.', 5, 1, '45069', '9/23/1998', 1, '859-986-2236', '[email protected]', '223-78-6654', 1, 3, 1)
,(4, 'Lan', 'Kim', '44561 Oak Ave.', 4, 1, '45246', '6/11/1999', 1, '513-522-4187', '[email protected]', '133-87-6422', 2, 2, 3)
,(5, 'Tyler', 'Sims', '77 North Maple St.', 1, 1, '45219', '3/11/2001', 1, '513-522-4187', '[email protected]', '145-27-7521', 1, 1, 5)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
