Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Updating a sql table from a local cursor

Author  Topic 

alina_costin
Starting Member

8 Posts

Posted - 2003-09-30 : 02:26:54
Hi!
I'm doing a project in VisualFox using a SQL database.
When i try to update a SQL table with values from a local cursor nothing happens.
Pls help me !

p.s. :
sql table = pacient
cursor =v_fisa
handler =phsql

SQLEXEC(phsql,"update pacient "+ ;
"set cnume =(case v_fisa.cnume when '' then pacient.cnume else v_fisa.cnume end),"+;
"cprenum =(case v_fisa.cprenum when '' then pacient.cprenum else v_fisa.cprenum end),"+;
"ddatan =(case v_fisa.ddatan when { / / } then pacient.ddatan else v_fisa.ddatan end),"+;
"csex =v_fisa.csex,"+;
"cgrupas =v_fisa.cgrupas,"+;
"crh =v_fisa.crh,"+;
"cocupat =(case v_fisa.cocupat when '' then pacient.cocupat else v_fisa.cocupat end),"+;
"clocmun =(case v_fisa.clocmun when '' then pacient.clocmun else v_fisa.clocmun end),"+;
"cmediu =v_fisa.cmediu,"+;
"clocal =(case v_fisa.clocal when '' then pacient.clocal else v_fisa.clocal end),"+;
"cjudet =(case v_fisa.cjudet when '' then pacient.cjudet else v_fisa.cjudet end),"+;
"cadresa =(case v_fisa.cadresa when '' then pacient.cadresa else v_fisa.cadresa end),"+;
"casig =v_fisa.casig,"+;
"cccas =v_fisa.cccas"+;
"where cid='&pcid'")

the sintax with case is used to protected my table from updating with null values and damage the existing values

Thank you !


Alina Costin

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-09-30 : 04:18:14
Is not this piece (e.g.)

"casig =v_fisa.casig,"+;
"cccas =v_fisa.cccas"+;

should be

"casig =" + v_fisa.casig + "," +;
"cccas =" + v_fisa.cccas + "+; ?

Then, I think it must be quoted '{ / / }'

PS I don't know FoxPro.
Go to Top of Page

alina_costin
Starting Member

8 Posts

Posted - 2003-09-30 : 05:43:57
Thank you Stoad ...it almost worked ..
exact the code should be :

"casig ='" + v_fisa.casig + "'," +;
"cccas ='" + v_fisa.cccas + "'," +;....etc.

Alina Costin
Go to Top of Page
   

- Advertisement -