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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how to update fields w/o explicity stating'em?

Author  Topic 

SQLIsTheDevil
Posting Yak Master

177 Posts

Posted - 2007-11-19 : 10:55:41
I created a query which returned one record from a table and every field in said table. If there are any changes in the fields, via some manipulation in my code, then I must add a new record to this table, copying ALL fields.

Let's say one field name, Type, is the only one that changes. And I have 15 other fields which were not affected in the slightest. Must I explicity type out all 16 field name and value pairs, or is there a query that allows me to only explicity state the fields that changed and it automatically copies over the ones that remained unchanged?

Thank you.

georgev
Posting Yak Master

122 Posts

Posted - 2007-11-19 : 11:55:59
I have no idea what you're asking ;)
Maybe giving us some sample data would help?


George
<3Engaged!
Go to Top of Page

cognos79
Posting Yak Master

241 Posts

Posted - 2007-11-19 : 17:17:43
you have to explicitly type all field names in the update statement.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-11-20 : 07:54:45
"If there are any changes in the fields, via some manipulation in my code, then I must add a new record to this table, copying ALL fields."

Well.. I dont understand why you would insert a whole new record when you could simply update the old one.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -