View previous topic :: View next topic
|
Author |
Message |
kedarreddy827 Warnings : 1 New User
Joined: 21 Sep 2005 Posts: 5
|
|
|
|
Hi
i updated with values in two colomns in a table.i want to drop those two coloumn values ,not columns. post a query to do the same.
thank you
k. |
|
Back to top |
|
|
red_roses
New User
Joined: 31 Oct 2005 Posts: 27
|
|
|
|
Pls elaborate more, do u want to just erase the values in the 2 columns that u just updated?? |
|
Back to top |
|
|
sri.mainframes
New User
Joined: 16 Feb 2006 Posts: 29 Location: MUMBAI
|
|
|
|
Hi Reddy,
try this query
delete column1, column2 from tablename;
thanks
SRI.PRINCE |
|
Back to top |
|
|
red_roses
New User
Joined: 31 Oct 2005 Posts: 27
|
|
|
|
sri.price have u even tried this query .....???
Delete command in sql deletes a row , not columns
and ur above query wont even execute, it is incorrect |
|
Back to top |
|
|
appasi
New User
Joined: 12 Dec 2005 Posts: 20 Location: Bangalore
|
|
|
|
Hi kedarreddy827,
If you want to delete two colomn valuse from the same colomn
DELETE colo-name FROM TBL-name
WHERE condition< should fetch two rows>;
If you want to delete values from two different colomns
DELETE column1, column2 FROM TBL-name
WHERE condition< should fetch one row>; |
|
Back to top |
|
|
radhakrishnan82
Active User
Joined: 31 Mar 2005 Posts: 435 Location: chennai, India
|
|
|
|
we can remove values present in the column by moving spaces to these
2 columns and update it with respect to the condition in the WHERE clause. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
k,
There is no single universal SQL that will remove a value from a column. You must know how the table was defined.
If the column was defines as being nullable then you can set ?column_name = null?
But if the column was defined as nullable with a default value you can still set the column_name = null, but may want to set it to the default value.
If the column was defined as ?NOT_NULL? then you MUST supply a value.
See this link for default values Identifying defaults
The default default values are described above; however, the table may be defined with a different default value.
How was the table defined, and what do you want the value to be after you re-set it and we can give you an SQL.
Dave |
|
Back to top |
|
|
jayanta_nit
New User
Joined: 13 Apr 2006 Posts: 22 Location: hyderabad
|
|
|
|
hi,
I dont think there is any SQL query to delete only column values not the column......u can do two things
1. u can just make the column NULL by set column name=NULL and
2. in cobol we can do that 1st just move that column to any host variable and then MOVE SPACES To HOST-VAR and then again HOST-VAR to that column.
Just try i think it will work..
pls correct me if i'm wrong....
Regards
Jayanta kr. Mondal. |
|
Back to top |
|
|
|