Unix Technical Forum

Re: dummy update

This is a discussion on Re: dummy update within the Informix forums, part of the Database Server Software category; --> On Wed, 2005-11-16 at 12:28, vasilis wrote: > > unload to "executeme.sql" > > select "update "||x1.tabname||" set "||x2.colname||"="||x2.colname ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 10:36 AM
Carsten Haese
 
Posts: n/a
Default Re: dummy update


On Wed, 2005-11-16 at 12:28, vasilis wrote:
> > unload to "executeme.sql"
> > select "update "||x1.tabname||" set "||x2.colname||"="||x2.colname
> > ||" where 1=1;--"
> > from systables x1, syscolumns x2
> > where x1.tabid = x2.tabid and x1.tabid>=100
> > and x2.colno = 1;

>
> Good script, but 1-st column is serial type often and you will find
> message
> " 232: A SERIAL column (....) may not be updated"


Indeed, I didn't think about that. Let's use the leftmost non-serial
column then:

unload to "executeme.sql"
select "update "||x1.tabname||" set "||x2.colname||"="||x2.colname
||" where 1=1;--"
from systables x1, syscolumns x2
where x1.tabid = x2.tabid and x1.tabid>=100
and x2.colno = (
select min(x3.colno) from syscolumns x3
where x3.tabid = x1.tabid
and mod(x3.coltype, 256) not in (6,18)
);

-Carsten
sending to informix-list
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com