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
 General SQL Server Forums
 New to SQL Server Programming
 Difference between INSERT and UPDATE

Author  Topic 

flamblaster
Constraint Violating Yak Guru

384 Posts

Posted - 2008-07-05 : 23:40:08
Until now, I've only ever used SELECT queries. I'm a bit confused at the difference between INSERT and UPDATE. I have a scenario where I want to change a boolean field from 0 to 1 after a certain date each month. I think I would use the following:

UPDATE BOOKING
SET Suppressed=1
WHERE Suppressed =0
AND LDATE>=?

Does this make sense? Or would it make more sense to use an INSERT query in this case?

Thanks!
Craig

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-05 : 23:52:06
Sounds ok. Insert is for adding rows to table by the way.
Go to Top of Page

flamblaster
Constraint Violating Yak Guru

384 Posts

Posted - 2008-07-06 : 00:03:49
RMIAO...Awesome! Thanks. That totally makes sense now. I've been reading up on it by my eyes are starting to get crosseyed :). It's difficult to work on some of these things when I don't have access to that function. (I can't do UPDATE queries, I need to ask our IT Manager to set up a recurring function and it always helps if I can write it first...gets done faster that way :p )
Go to Top of Page
   

- Advertisement -