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 |
|
Nitu
Yak Posting Veteran
81 Posts |
Posted - 2006-12-27 : 14:11:25
|
| I am really sorry for asking such a silly question (if u think this is a silly question), My mind has become blank whn=en i got this doubt, dint want to waste any time, so am asking u guys.What will be the result of this statement:Delete field1 from table1 where field2 = 'xyz'where field1 and field2 are varchars of table1.Also, Can the following be done. I saw this in somebodies code,Delete table1.field1 from table1, table2 where table1.field2 = table2.field2 and table1.field3 = 'xyz'here also lets say all the fields are varchars Thanks a lot in advance,Nitu |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-12-27 : 14:20:36
|
| Did you try it, or look up DELETE in Books Online?The result of that statement will be an error, you cannot specify a field/column name in a DELETE statement because you delete whole rows from a table, not fields/columns. You use the fields in the WHERE clause to determine which rows get deleted. |
 |
|
|
Nitu
Yak Posting Veteran
81 Posts |
Posted - 2006-12-27 : 14:38:33
|
| I currently dont have access to any database for me to try this out, as I am suppose to document the flow of data in sombody's developed code for now. So i wasnt sure if these two statements will result in error or if they will do something to the table. I did look up online, I dint get any examples for Delete Field. I wanted to make sure about this.Will these statements work in SYBASE. coz, they have written for sybase. Please let me know if you know about this.Thanks a lot in advance,Nitu |
 |
|
|
JoeNak
Constraint Violating Yak Guru
292 Posts |
Posted - 2006-12-27 : 15:20:00
|
| It depends on what you mean by delete....Do you want to clear the data in a field? --> UPDATEDo you want to delete the field from the table? --> ALTER TABLENo development environment? Not even a development database? You might want to download MSDE or SQL Server 2005 Express and install on your workstation/laptop... |
 |
|
|
Nitu
Yak Posting Veteran
81 Posts |
Posted - 2006-12-27 : 15:37:34
|
| Unfortunately not allowed to download anything from internet and install. I had Rapid sql. But there has been some problems with it, so am not able to use it. The organization takes weeks together to correct something. Cant do much about that. So what u r saying is, Delete field1 from table1 doesnt work in SYBASE also.Thanks in advance,Nitu |
 |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-12-27 : 15:44:06
|
| No, I'm pretty sure it won't work in Sybase either - although this is a SQL Server forum, so you should rather post your questions on a Sybase forum. |
 |
|
|
Nitu
Yak Posting Veteran
81 Posts |
Posted - 2006-12-27 : 15:59:37
|
| Thank you for ur reply. |
 |
|
|
|
|
|
|
|