I'd like to insert the results of this query to the table I created below.
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[Entity]') AND type in (N'U'))
DROP TABLE [Entity]
Go
Create Table Entity
([EntCode] [nvarchar](8) NOT NULL,
[Name] [nvarchar](80) NOT NULL,
[CompanyRegistration] [nvarchar](80) NULL,
[Active] [int] NOT NULL,
[AccessLevel] [int] NOT NULL ,
[SiteURN] [nvarchar](128) NOT NULL,
[CompanyURN] [nvarchar](128) NOT NULL,
[SiteName] [nvarchar](30) NOT NULL,
[SiteDesc] [nvarchar](60) NULL,
[SiteURL] [nvarchar](512) NOT NULL)
And I'd like to insert the Data from this query using this, however I get this error "Insert Error: Column name or number of supplied values does not match table definition"
because I have an extra column [CompanyRegistration] nvarchar NULL, which I decalred NULL upon creation of the table. How can I insert these query results with my [CompanyRegistration] column tagged as NULL in the table??
insert into ResourceTaskFact.dbo.Entity
Select
e.EntCode,
e.Name,
e.Active ,
e.AccessLevel,
ss.SiteURN,
ss.CompanyURN,
ss.SiteName ,
ss.SiteDesc ,
ss.SiteURL
from SMECSite ss, SMECLegalEnt e
where ss.localsiteflag = 1
and e.active = 1
How do I solve this? I need your help Guys. Thank you in Advance!
Beau