IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want to drop those two coloumn values, not columns


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kedarreddy827
Warnings : 1

New User


Joined: 21 Sep 2005
Posts: 5

PostPosted: Thu May 04, 2006 9:57 am
Reply with quote

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
View user's profile Send private message
red_roses

New User


Joined: 31 Oct 2005
Posts: 27

PostPosted: Thu May 04, 2006 11:22 am
Reply with quote

Pls elaborate more, do u want to just erase the values in the 2 columns that u just updated??
Back to top
View user's profile Send private message
sri.mainframes

New User


Joined: 16 Feb 2006
Posts: 29
Location: MUMBAI

PostPosted: Thu May 04, 2006 1:44 pm
Reply with quote

Hi Reddy,

try this query

delete column1, column2 from tablename;

thanks
SRI.PRINCE
Back to top
View user's profile Send private message
red_roses

New User


Joined: 31 Oct 2005
Posts: 27

PostPosted: Thu May 04, 2006 2:01 pm
Reply with quote

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
View user's profile Send private message
appasi

New User


Joined: 12 Dec 2005
Posts: 20
Location: Bangalore

PostPosted: Thu May 04, 2006 2:39 pm
Reply with quote

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
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Thu May 04, 2006 2:46 pm
Reply with quote

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
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri May 05, 2006 3:17 am
Reply with quote

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
View user's profile Send private message
jayanta_nit

New User


Joined: 13 Apr 2006
Posts: 22
Location: hyderabad

PostPosted: Tue May 09, 2006 3:15 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Remote Unload of CLOB Columns DB2 6
No new posts DROP & ALTER PARTITION-PBR DB2 0
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top