Yeah, I know. It's not the primary key. It's going to be a foreign key to a
"tblCompany".

-----Original Message-----
From: Randell B Adkins [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 3:51 PM
To: CF-Talk
Subject: Re: SQL Question


If CompanyID is a unique Field in this table, then you can not update
it by using the same number multiple times.

if it is a number field or text field which the table does not have a
primary key to disallow multiples then you are ok.

>>> [EMAIL PROTECTED] 11/26/02 10:29AM >>>
OK, I tried asking this on SQL Team and nobody understood. I want to
populate a new column in my tblBusiness called companyid. If there are
5
records for "Publix" I want all 5 to have the same companyid. I could
do it
using CF very easily like this:
<cfquery name="Q1" datasource="FL100">
        SELECT    distinct company AS company
        FROM      tblBusiness
</cfquery>

<cfoutput query="Q1">
        <cfquery name="Q2">
                UPDATE tblBusiness
                SET companyid = #currentrow#
                WHERE company = '#company#'
        </cfquery>
</cfoutput>

My question is how ccan I do this in query analyzer. I'm sure you can
create
loops and variables in an SQL script, I just don't know how.
***Sterling Financial Investment Group, Inc. (SFIG) is a member of
NASD/MSRB/NFA/SIPC.  Email transmissions may be monitored.  SFIG
cannot
accept orders to buy or sell via email.  Please visit
www.mysterling.com for
more information.***


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to