Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Want to drop those two coloumn values, not columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Want to drop those two coloumn values, not columns
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 436
Location: chennai, India

PostPosted: Thu May 04, 2006 2:46 pm    Post subject:
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    Post subject: Re: Want to drop those two coloumn values, not columns
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    Post subject: Re: Want to drop those two coloumn values, not columns
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us