Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mcupryk
Yak Posting Veteran
91 Posts |
Posted - 2011-03-09 : 10:34:52
|
| Given the source tableDESTINATION TABLE where whre Provider ID is the join.CREATE TABLE [dbo].[tblContactHistory]( [HistoryID] [int] NOT NULL, [ProviderID] [int] NULL, [Type] [nvarchar](20) NULL, [EffectiveDate] [datetime] NULL, [Information] [nvarchar](250) NULL, [FinancialContactPrefix] [nvarchar](4) NULL, [FinancialContact] [nvarchar](50) NULL, [FinancialPosition] [nvarchar](50) NULL, [FinancialPhone] [nvarchar](14) NULL, [FinancialExtension] [nvarchar](4) NULL, [FinancialFax] [nvarchar](14) NULL, [FinancialEmail] [nvarchar](50) NULL, CONSTRAINT [PK_tblContactHistory_1] PRIMARY KEY CLUSTERED ( [HistoryID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[tblContactHistory] WITH CHECK ADD CONSTRAINT [FK_tblContactHistory_tblServiceProvider] FOREIGN KEY([ProviderID])REFERENCES [dbo].[tblServiceProvider] ([ProviderID])GOALTER TABLE [dbo].[tblContactHistory] CHECK CONSTRAINT [FK_tblContactHistory_tblServiceProvider]GO---------------------------------------------------INSERT INTO tblFinancialContact ([FinancialContactID],[ProviderID],[FinancialContactPrefix],[FinancialContact],[FinancialPosition],[FinancialPhone],[FinancialExtension] ,[FinancialFax] ,[FinancialEmail] )[FinancialContactPrefix],[FinancialContact],[FinancialPosition],[FinancialPhone],[FinancialExtension] ,[FinancialFax] ,[FinancialEmail] FROM dbo.tblContactHistory where tblContactHistory.ProviderID = tblServiceProvider.ProviderID???????Any help would be awesome. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-03-09 : 10:37:50
|
[code]FROM dbo.tblContactHistoryINNER JOIN tblServiceProvider ON tblContactHistory.ProviderID = tblServiceProvider.ProviderID[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mcupryk
Yak Posting Veteran
91 Posts |
Posted - 2011-03-09 : 11:10:19
|
| INSERT INTO tblContactHistoryTest ([FinancialContactPrefix],[FinancialContact],[FinancialPosition],[FinancialPhone],[FinancialExtension] ,[FinancialFax] ,[FinancialEmail] )[FinancialContactPrefix],[FinancialContact],[FinancialPosition],[FinancialPhone],[FinancialExtension] ,[FinancialFax] ,[FinancialEmail] FROM dbo.tblContactHistoryTestINNER JOIN tblServiceProvider ON tblContactHistoryTest.ProviderID = tblServiceProvider.ProviderIDMsg 102, Level 15, State 1, Line 11Incorrect syntax near 'FinancialContactPrefix'.Any help would be awesome. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-03-09 : 11:19:22
|
quote: Originally posted by mcupryk INSERT INTO tblContactHistoryTest ([FinancialContactPrefix],[FinancialContact],[FinancialPosition],[FinancialPhone],[FinancialExtension] ,[FinancialFax] ,[FinancialEmail] )SELECT[FinancialContactPrefix],[FinancialContact],[FinancialPosition],[FinancialPhone],[FinancialExtension] ,[FinancialFax] ,[FinancialEmail] FROM dbo.tblContactHistoryTestINNER JOIN tblServiceProvider ON tblContactHistoryTest.ProviderID = tblServiceProvider.ProviderIDMsg 102, Level 15, State 1, Line 11Incorrect syntax near 'FinancialContactPrefix'.Any help would be awesome.
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|