Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us