Welcome to dbFreaks.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Can I Update entire record in SQL ?

 
   Database Help (Home) -> Visual Basic RSS
Related Topics:
DAO 3.6 record locking - Hello, I want to lock users' password records after they log on to a VB6 I want to be able to determine who is logged on to the database by polling each password record to see if it is locked or not. (DBF files allowed this sort of ..

update query - I have created an update query in my to change the date in the bound table to the sys date. However, the query will not accept '=Date' in the new value box. Does anyone know the correct function. The help gives it as 'Date' Ian

New record with data from other form - I would like to open a addrecord form. In this form I would like teh Field DebNr to be filled with the value of the field DebNr in my (open) form FrmStam. I used the code ; Private Sub As Integer) If

Open form to add record with fielddata from an open form - How do I open a form to add a record and get the data for 1 field from a specific field in a open form. I have used the following code ; Private Sub As Integer) If Then = _ ..

NEWBIE insert data rather than update in db - I have an app for tracking mileage on company vehicles. On the first form you select a combobox getting vehicle names from database) and enter the info. Then I need to export that data back to the database. The ? is how do I..
Next:  Visual Basic: reading a text file?  
Author Message
only

External


Since: Feb 22, 2005
Posts: 1



(Msg. 1) Posted: Tue Feb 22, 2005 5:40 am
Post subject: Can I Update entire record in SQL ?
Archived from groups: comp>lang>basic>visual>database (more info?)

Heya,

I am working on making a SQL database an exact mirror of a local
Access database. I check the .mdb database every few minutes for new
entries, if there are new entries, I retrieve them and write them to
an exact replica table in SQL. This all works but when I write the
values to the SQL table, If I use "INSERT INTO" or UPDATE I have to
write the value of each field from the Access database into each field
of the SQL database.

Is there any way I can update the entire record into SQL in one go ?
Like This:
--------------------------------------------------------------------------------
My tables are called "JobCard" in SQL and Access.

On Access side: Get the data:

rsax.Open "Select * From JobCard Where UPD = False", dbax,
adOpenStatic, etc


(On SQL side)
(This doesn't work but I would like something like it: )

db.Execute "Update INTO Jobcard Values * "

Where I want to update all the fields from the Access statement into
SQL without having to iterate through each field.

I have over 100 tables, each with at least 10 fields so I would save a
lot of time if I could just update all the fields at once.

Your help is much appreciated.

JimInDurbs.
RSA

 >> Stay informed about: Can I Update entire record in SQL ? 
Back to top
Login to vote
Michael B. Johnson

External


Since: May 14, 2004
Posts: 16



(Msg. 2) Posted: Tue Feb 22, 2005 12:55 pm
Post subject: Re: Can I Update entire record in SQL ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 22 Feb 2005 11:27:20 +0200, only.DeleteThis@here.co.za wrote:

 >(This doesn't work but I would like something like it: )
 >
 >db.Execute "Update INTO Jobcard Values * "
 >
 >Where I want to update all the fields from the Access statement into
 >SQL without having to iterate through each field.
 >
 >I have over 100 tables, each with at least 10 fields so I would save a
 >lot of time if I could just update all the fields at once.

There's no way I know of to UPDATE without listing each field value.

UPDATE JobCard
SET [Field_1] = 'First', [Field_2] = 'Second'
WHERE RecordId = 55

however, you will see that you can update a single record in one
statement. So, write a function to generate the SQL statement. You
could look for the SmartSQL Class from <a style='text-decoration: underline;' href="http://www.freevbcode.com," target="_blank">www.freevbcode.com,</a> or
something similar - it may save you some time.

Dim oSQL As New SmartSQL.clsSmartSQL, sSQL As String

oSQL.AddTable "Order Items"
oSQL.AddFields "ItemCost", "Tax", "ShippingCost", "TotalCost"
oSQL.AddSimpleWhereClause "OrderID", 1
sSQL = oSQL.SQL

‘ Resuting sSQL = "SELECT ItemCost, Tax, ShippingCost, TotalCost FROM
[Order Items] WHERE (OrderID = 1)"

You can change the SQL to an update query using a property, I think.
_______________________
Michael B. Johnson<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Can I Update entire record in SQL ? 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> Visual Basic All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]