Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: SQL Update Error

by pelagic (Priest)
on Feb 18, 2004 at 15:28 UTC ( [id://329933]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: SQL Update Error
in thread SQL Update Error

... and what would that mean in terms of above sql-stmt?
pelagic

-------------------------------------
I can resist anything but temptation.

Replies are listed 'Best First'.
Re: Re: Re: Re: SQL Update Error
by monktim (Friar) on Feb 18, 2004 at 17:02 UTC
    It wouldn't mean anything. The FROM clause isn't needed here but having it isn't an error in T-SQL. But, the OP didn't say MS SQL Server was being used so who knows.

    Like other posters said, it looks like the problem is with quoting. I'm also not sure what's going on with all the '.' characters all over the place. I recommend printing out $up. If you don't see an obvious error, cut and paste it to the query analyzer and run it. The SQL Server will surely tell you if there is a problem.

    The code below may be closer to what you need.

    my $up = qq/ UPDATE Prior_to_CI_calc_A_${region} SET SUM_wi = $SUM_Weight_wi, Sum_wixi_x_1000 = $SUM_wixi_x_1000_fill, Sum_wi2xi_x_1000 = $SUM_wi2xi_x_1000_fill WHERE Aggregated_area LIKE '$Aggregated_area_fill' AND Cause LIKE '$Cause_fill' /;
Re: Re: Re: Re: SQL Update Error
by mpeppler (Vicar) on Feb 18, 2004 at 21:55 UTC
    As monktim says - in this particular case it serves no purpose. You'd use that form to limit the rows that are updated, or fetch data with which you wish to update the target table with a join, like this:
    update the_table set col1 = t2.col2 from the_table t1 , other_table t2 where t2.id = t1.id and t1.somecol = "some value" and t2.anothercol = "some other value"
    Having used Sybase for 15+ years I'm really used to this syntax, and I find it quite powerful (and you can do the same thing with DELETE of course).

    Michael

      ... looks reasonable to me.
      I use Oracle and DB2 and didn't know that feature but can imagine it's usefulnes.
      pelagic

      -------------------------------------
      I can resist anything but temptation.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://329933]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-29 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found