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
 Help explaing an sql statment?

Author  Topic 

w1ckit
Starting Member

1 Post

Posted - 2006-05-07 : 16:05:11
Hi everyone. I'm very new to SQL but I've been asked to provide a explanation for an SQL statement as part of a presentation I have to do for work.

Yup, how unfair :)

Can anyone help me?

The statement is as follows:

UPDATE company.incidents set Priority = 1 where resltime = 0


I just need to understand the basic functionality of the above. I've tried books and I can't work it out. Any help will be soooo appreciated.

Thanks in advance.

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-05-07 : 17:01:18
no better way than to
1. read a book http://www.sqlteam.com/store.asp
or
2. go for some training on SQL Syntax


UPDATE company.incidents set Priority = 1 where resltime = 0

what is your table name ?

should be something like this

UPDATE incidents set Priority = 1 where resltime = 0

am assuming incidents is your table name ???
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-07 : 17:35:35
Company would be the schema name possibly.

It's difficult to explain the query and make it any clearer than the statement itself.

maybe update all rows in the table where resltime = 0 setting Priority to 1
not sure that's adds anything to
UPDATE company.incidents set Priority = 1 where resltime = 0
though.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2006-05-08 : 14:09:58
I'm baffled that a company would actually waste time in some kind of meeting have someone who obviously doesn't understand SQL explain an SQL Command. How little is everyones time worth at that company?

It sounds more like "I've slept through the last semester and have no idea how to do my homework question, but I am smart enough to have read that nobody answers questions on homework so I've made up a story about doing this at work." Which works for me since at least they put some thought behind the question before writing it.

If this is TSQL Code, then Company would be the owner of the Incidents table, which doesn't seem to make sense as a user name. So perhaps Company..Incidents? The command is going to update/change the value of the priority field to a 1 for every record in the Incidents TABLE (owner/database named Company) that currently has a value of 0 in the resltime field.

Hope it helps,
Dalton

Blessings aren't so much a matter of "if they come" but "are you noticing them."
Go to Top of Page
   

- Advertisement -