Invalid column name??

Robert DeMaree 111 Reputation points
2022-06-30T13:22:40.867+00:00

Given the following excerpt:
CREATE TABLE dbo.PlanOfCareLimitationTypes
( iPlanOfCareLimitationTypeID INT IDENTITY(1,1) NOT NULL,
sPlanOfCareLimitationCategory CHAR(6) NOT NULL,
sPlanOfCareLimitation VARCHAR(MAX) NOT NULL,
dtDateAdded DATETIME NOT NULL,
dtPurgeDate DATETIME NOT NULL,
dtDateUpdated DATETIME NULL,
dtDateDeleted DATETIME NULL,
chkIsTestRecord CHAR(1) NOT NULL,
chkIsInactive CHAR(1) NOT NULL
PRIMARY KEY CLUSTERED (iPlanOfCareLimitationTypeID ASC));

INSERT INTO dbo.PlanOfCareLimitationTypes
(sPlanOfCareLimitationCategory <= Why is this considered an “Invalid column?!?”
, sPlanOfCareLimitation
, dtDateAdded
, dtPurgeDate
, chkIsTestRecord
, chkIsInactive) VALUES
('18A'
,'Amputation'
, GETDATE()
, DATEADD(YEAR,7,GETDATE())
, 'N'
, 'N');

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,165 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,589 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bert Zhou-msft 3,421 Reputation points
    2022-07-01T02:30:08.973+00:00

    I suspect that there is a drop table in front of your table creation. Sometimes a prompt does not mean there is a problem. You can select the code and execute it all. If this is not the problem, refresh the cache and restart the client, copying the existing code to the new window.

    Bert Zhou

    1 person found this answer helpful.
    0 comments No comments