Viewing 13 posts - 1 through 13 (of 13 total)
Thanks LutzM for your reply. Just to make you happy I changed the greeting. Could you please illustrate the use of the output clause?
July 23, 2011 at 3:07 am
The following code worked for me.
/* INSERTs companyid and industryid INTO INDUSTRYASS table */
INSERT INTO IndustryAss(CompanyId, IndustryId)
SELECT DISTINCT dbo.company.CompanyId, dbo.industry.IndustryId
FROM Company, Industry, dbo.source
WHERE dbo.source.company=dbo.Company.CompanyName and dbo.source.Industry=dbo.industry.IndustryName
GO
April 26, 2011 at 4:07 pm
Hi Guys I have been writing the query to populate the associative entity:
/* Inserts companyid and industryid into industryass table */
INSERT INTO IndustryAss
SELECT DISTINCT dbo.company.CompanyId, dbo.industry.IndustryId
FROM Company, Industry, dbo.source
WHERE dbo.source.company=dbo.Company.CompanyName...
April 25, 2011 at 4:24 pm
Thanks for your responses. But I need to say that there is no companyid and industryid in the source for inserting. This (Ids) will come from the tables mentioned where...
April 25, 2011 at 3:35 pm
Hi Chris I just tried the insert statement and modify the one that I previously had and It worked.
Thanks for your help.
Martin
April 22, 2011 at 12:00 am
Sorry Chris but I don't expect this result.
"Also, INSERT statements to create data in both tables which will generate this result:
CompanyName StreetNumber StreeName StreetType Suburb Postcode State
123 Acc Brisbane 4000...
April 21, 2011 at 4:12 pm
I don't understand what you mean.
Please explain.
Thanks
April 21, 2011 at 8:33 am
Hi Chris:
-------------------------COMPANY TABLE------------------------------------------------------
USE [VisitationDb]
GO
/****** Object: Table [dbo].[Company] Script Date: 04/21/2011 17:39:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Company](
[CompanyId] [int] IDENTITY(0,1) NOT NULL,
[CompanyName] [nvarchar](150) NULL,
[Website] [nvarchar](200) NULL,
[IndustryId]...
April 21, 2011 at 1:45 am
Hi LutzM:
This makes sense. I am going to try it in the afternoon and post back the results. Thanks for that.
March 29, 2011 at 2:55 pm
Ok I found what makes a unique record, but now how I am going to be able to update the foreign keys so that they match with the other table?...
March 29, 2011 at 1:03 am
I am not sure about what you are proposing. The insert works in the first table but how can I insert into the second while maintaining the relationship. I need...
March 29, 2011 at 12:22 am
Viewing 13 posts - 1 through 13 (of 13 total)