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.
| Author |
Topic |
|
adila
Starting Member
5 Posts |
Posted - 2006-02-04 : 10:49:56
|
| Hello all,How can I use UPDATE command inside the SELECT command (anywhere in WHERE clause, FROM clause or...).I want to update sth. when i select sth.Is it possible just with SELECT and nothing else? |
|
|
stats
Starting Member
10 Posts |
Posted - 2006-02-04 : 11:00:15
|
| Why do u want to use it in a SELECT statement, u canj just use the update statement on its own:UPDATE table_nameSET column_name = new_valueWHERE column_name = some_valuethe where clause is the same as u wud use in the select statement.STaTs |
 |
|
|
adila
Starting Member
5 Posts |
Posted - 2006-02-04 : 11:07:50
|
| It is needed for a SQL injection security test...I need something like this:select 1 where 1=1 or (update...)Thanks |
 |
|
|
stats
Starting Member
10 Posts |
Posted - 2006-02-04 : 11:17:21
|
| IF EXISTS (SELECT columnx FROM table_name WHERE columnx = valueP)BEGINUPDATE table_nameSET columnx = new_valueWHERE columnx = valuePENDSTaTs |
 |
|
|
|
|
|