I need to build an UPDATE statement that copies the values of roughly 40
fields from a table that stores standard or default values into a table of
specific contracts. There are 8 or so fields in the source table that are
not in the destination table. The remaining field names are identical in
both tables. How do I create a recordset of the field names I am interested
in so that I can loop through it to build my UPDATE statement?
Thank you 3 2874
WC Justice wrote: I need to build an UPDATE statement that copies the values of roughly 40 fields from a table
Oops - you forgot to tell us what type and version of database you are
using. I Suspect Access, but it would be nice to be sure.
that stores standard or default values into a table of specific contracts.
Simple answer:
Don't
Don't store the same data twice. You are likely to be using a relational
database here. By storing te same data twice, you are interfering with the
ability of the rdbms to preserve data integrity.
Instead of copying all these values to a separate table, store a link to the
standard values.
The only reason not to do this is if you need to track historicity, i.e.,
you need to know what the values were at the time the record was created.
But even this can be done without copying the data by using EffectiveDate
and DiscontinueDate columns in the standards table.
There are 8 or so fields in the source table that are not in the destination table. The remaining field names are identical in both tables. How do I create a recordset of the field names I am interested in so that I can loop through it to build my UPDATE statement?
If you're bound and determined, then you have a few options, which you can
read about here: http://www.aspfaq.com/show.asp?id=2177, although he did
leave out the OpenSchema option which you can read about here: http://msdn.microsoft.com/library/en...openschema.asp
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Thanks for the response. This is an ASP-based website with a Microsoft 2003
Windows Small Business Server SQL Server back end.
I respect your advice regarding duplicating of records, however it is
necessary in this case. Each contract contains these 40 provisions which
need to be editable at the contract level. When the user indicates that he
wants to create a new contract, one of the subroutines attaches the default
provisions to the new contract, which are then edited as necessary or
appropriate. I started hard coding the SQL string but was hoping to avoid
doing it for both the INSERT and UPDATE statements.
A scan of the links you provided makes me feel that it may be a little over
my head, but if you think it will address my question, I will study it until
I get it.
Thanks again.
"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l... WC Justice wrote: I need to build an UPDATE statement that copies the values of roughly 40 fields from a table Oops - you forgot to tell us what type and version of database you are using. I Suspect Access, but it would be nice to be sure.
that stores standard or default values into a table of specific contracts.
Simple answer:
Don't
Don't store the same data twice. You are likely to be using a relational database here. By storing te same data twice, you are interfering with the ability of the rdbms to preserve data integrity.
Instead of copying all these values to a separate table, store a link to
the standard values.
The only reason not to do this is if you need to track historicity, i.e., you need to know what the values were at the time the record was created. But even this can be done without copying the data by using EffectiveDate and DiscontinueDate columns in the standards table.
There are 8 or so fields in the source table that are not in the destination table. The remaining field names are identical in both tables. How do I create a recordset of the field names I am interested in so that I can loop through it to build my UPDATE statement?
If you're bound and determined, then you have a few options, which you can read about here:http://www.aspfaq.com/show.asp?id=2177, although he did leave out the OpenSchema option which you can read about here: http://msdn.microsoft.com/library/en...openschema.asp
Bob Barrows
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
WC Justice wrote: Thanks for the response. This is an ASP-based website with a Microsoft 2003 Windows Small Business Server SQL Server back end.
I respect your advice regarding duplicating of records, however it is necessary in this case. Each contract contains these 40 provisions which need to be editable at the contract level. When the user indicates that he wants to create a new contract, one of the subroutines attaches the default provisions to the new contract, which are then edited as necessary or appropriate.
Why insert them at this point? Why not simply retrieve the values and
present them to the user in the editing page? Then, when he saves his edits,
write the final version of the contract into the database. Just a
suggestion.
I started hard coding the SQL string but was hoping to avoid doing it for both the INSERT and UPDATE statements.
I would hard-code it anyways. You can use QA (if you have it) to generate
the list of columns using one of the techniques in the aspfaq article. A scan of the links you provided makes me feel that it may be a little over my head, but if you think it will address my question, I will study it until I get it.
Start studying :-)
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rob Young |
last post by:
This is the latest in the "Total Non-Programmer" series. Any feedback on
the usability of this tutorial would be greatly appreciated.
Thanks,
Rob
How to Build A Web Database (Without Programming)
This article will teach you step-by-step how to add interactive
database-driven capabilities to your existing web site. When the steps
|
by: Douglas Buchanan |
last post by:
I am using the following code instead of a very lengthly select case
statement.
(I have a lot of lookup tables in a settings form that are selected
from a ListBox. The data adapters are given a similar name to the
table. Rather than making a long Select Case that could become
obsolete if lookup tables are added and the source table of the
ListBox is edited I came up with this code.)
This code works but of course it gives me build...
|
by: H |
last post by:
This is a question that has haunted me for quite some time.
if you build a 4 tier database application where the 4th tier is the
database server (MS SQL 2000), where do you build the connection string?
The obvious answer is to hard code it into the middle layer and use a config
file.
The problem is the database application needs to be distributed to
purchasing clients. Therefore, you do not know, at development, what the SQL
|
by: Soundneedle |
last post by:
I have code that loops through a record set, which build an outlook
email's body. The problem is, I don't know how to "build" the .body
while in the loop without resetting the .body's value to the current
record.
For example, the .body should equal:
John
Jake
Debby
|
by: Chad Myers |
last post by:
I've been perf testing an application of mine and I've noticed that there
are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String
instances being created.
I've done some analysis and I'm led to believe (but can't yet quantitatively
establish as fact) that the two basic culprits are a lot of calls to:
1.) if( someString.ToLower() == "somestring" )
and
| |
by: Andy Sutorius |
last post by:
Hi,
I am receiving the error when compiling the project, "cannot implicitly
convert type object to string".
The error points to this line of code and underlines the
dtrRecipient: objMailMessage.To = dtrRecipient;
I'm not sure why I am getting this error. Below is the complete code I am
working with.
|
by: Tamarack |
last post by:
I have a simple function which loops through all the controls on a form
searching for a specific one:
Public Function FindControl(ByVal ctrls As Control.ControlCollection,
ByVal ctrlName As String) As Control
For Each ctrl As Control In ctrls
If ctrl.Name = ctrlName.Trim Then
Return ctrl
End If
|
by: BA |
last post by:
Hello,
I have a very strange code behavior that I cannot make heads or tails of:
I have c# code being executed in BizTalk assemblies which is acting very
strangely.
In my BizTalk process I call a static method:
public static string ValidateMessage(params...)
|
by: N L |
last post by:
Greetings,
I want to create a form in Access that shows a list of checkboxes to a
user. The checkboxes will be dynamically generated, showing the fields
in a table the user has selected in a combo box.
Can anyone tell me how to dynamically update a list of checkboxes like
that?
Thanks,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |