[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] Problems using INSERT/SELECT STMTS





         Hello All:

         I'm wondering if anyone has ever tried this before and got it to 
work -

         I have some SQL that I want to use to load a temp table with data.

         Before each record is loaded, there are two monetary fields that 
should be checked
         and possibly edited before being loaded into the temp table.  If 
the fields are either
         negative or null then, their values should be changed to 0.

         SQR does not like the syntax or something. It abended complaining 
about the
         = sign  after the fields that should be edited.   Here is the SQL 
I'm using.   By the way,
         I ran the SQL in SQL Server and it worked fine!    I use SQR 
Server v.6x and
         MicroSoft SQL Server 2000 v.8 --


begin-SQL
INSERT [$Temp_NetContrib]
SELECT
WDI_01.ID,
WDTA_01.netcontribtot,

WDTA_01.edit_netcontribtot =
         (CASE
                 WHEN netcontribtot IS NULL  THEN cast(0 as money)
                 WHEN netcontribtot < 0  THEN cast(0 as money)
                 ELSE cast(netcontribtot as money)
         END),

WDTA_01.netcommit,

WDTA_01.edit_netcommit =
         (CASE
                 WHEN netcommit IS NULL  THEN cast(0 as money)
                 WHEN netcommit < 0  THEN cast(0 as money)
                 ELSE cast(netcommit as money)
         END)

FROM            [$wk_dyn_IDList] WDI_01,
                 [$wk_dyn_tbl]    WDTA_01

WHERE WDI_01.id *= WDTA_01.id

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users