Author |
Topic |
ddtopgun
Starting Member
26 Posts |
Posted - 2014-06-04 : 04:53:16
|
hi can anyone help me how to change data with id is uniqueidentifierusing below the code the data can't be updated..IF @StatementType = 'Update' BEGIN UPDATE PC SET idFactory=(SELECT idFactory FROM Factory WHERE nmFactory=@nmFactory), idDepartemen=(SELECT idDepartemen FROM Departemen WHERE nmDepartemen=@nmDepartemen), nmKomputer=@nmKomputer, nmUser=@nmUser, Email=@Email, Jenis=@Jenis, Procesor=@Procesor, Frek=@Frek, Memory=@Memory, Hdd=@Hdd, Monitor=@Monitor, OS=@OS, Software=@Software, Statuss=@Statuss WHERE idPC=CONVERT(varchar(36),@idPC) --SELECT * FROM PC END |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-06-04 : 06:22:09
|
[code]IF @StatementType = 'Update' BEGIN UPDATE PC SET idFactory=Factory.idFactory, idDepartemen=Departemen.idDepartemen, nmKomputer=@nmKomputer, nmUser=@nmUser, Email=@Email, Jenis=@Jenis, Procesor=@Procesor, Frek=@Frek, Memory=@Memory, Hdd=@Hdd, Monitor=@Monitor, OS=@OS, Software=@Software, Statuss=@Statuss FROM PC as PC INNER JOIN Factory ON PC.idFactory = Factory.idFactory INNER JOIN Departemen ON PC.idDepartemen=Departemen.idDepartemen WHERE idPC=CONVERT(varchar(36),@idPC) AND Factory.nmFactory=@nmFactory AND Departemen.nmDepartemen=@nmDepartemen --SELECT * FROM PC END[/code]sabinWeb MCP |
|
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-06-04 : 06:23:23
|
or:DECLARE @idFactory INT ,@idDepartemen INT SELECT @idFactory = idFactory FROM Factory WHERE nmFactory=@nmFactory SELECT @idDepartemen = idDepartemen FROM Departemen WHERE nmDepartemen=@nmDepartemenIF @StatementType = 'Update' BEGIN UPDATE PC SET idFactory=@idFactory, idDepartemen=@idDepartemen, nmKomputer=@nmKomputer, nmUser=@nmUser, Email=@Email, Jenis=@Jenis, Procesor=@Procesor, Frek=@Frek, Memory=@Memory, Hdd=@Hdd, Monitor=@Monitor, OS=@OS, Software=@Software, Statuss=@Statuss WHERE idPC=CONVERT(varchar(36),@idPC) --SELECT * FROM PC END sabinWeb MCP |
|
|
ddtopgun
Starting Member
26 Posts |
Posted - 2014-06-04 : 08:55:36
|
Hi Stepson i already try the first and the 2nd code but the output still same 0 rows (s) affected..the data still can't update...fyi, idPC,idFactory,idDepartemen is uniqueidentifier type |
|
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-06-04 : 09:08:58
|
Trigger ?can you post some sample data?sabinWeb MCP |
|
|
ddtopgun
Starting Member
26 Posts |
Posted - 2014-06-04 : 09:24:29
|
not trigger but spbelow code for exec the spexec sp_isudpc 'mo','it','dsitest','testing','tes','pc','pc p4','3','1','80','lcd','xp','2003','','Update' |
|
|
ddtopgun
Starting Member
26 Posts |
Posted - 2014-06-04 : 10:04:00
|
case closed thanks...i already found my problem so now i can update the data..thank's to stepson for yr help |
|
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-06-05 : 00:58:58
|
Welcome!sabinWeb MCP |
|
|
|
|
|