| Author |
Topic |
|
zeitoun
Starting Member
5 Posts |
Posted - 2008-09-19 : 13:57:36
|
| need help have a problen when i write this sentences i trans-sqli need to update only 1 rows in diferente tables this the sentences use adn_coopemapUPDATE dbo.chd_cheques_detalleSET CHD_Cheques_Detalle.CHE_Codigo = COM_Compania.COM_Codigo FROM CHD_Cheques_Detalle,COM_CompaniaWHERE CHD_Cheques_Detalle.CHE_Codigo 5900A and COM_Compania.COM_Codigo 1GOand this errorsMsg 1032, Level 15, State 1, Line 3Cannot use the column prefix 'CHD_Cheques_Detalle'. This must match the object in the UPDATE clause 'dbo.chd_cheques_detalle'.Msg 170, Level 15, State 1, Line 5Line 5: Incorrect syntax near '5900'.all gurus in sql trans-sql please help thanks |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2008-09-19 : 14:03:27
|
This is basically just setting Checkes_Detail = 1, are you sure this is what you wantUPDATE aSET a.CHE_Codigo = b.COM_Codigo FROM CHD_Cheques_Detallea aCross JoinCOM_Compania bWHERE a.CHE_Codigo = 5900A and b.COM_Codigo = 1 If so useUPDATE aSET a.CHE_Codigo = 1FROM CHD_Cheques_Detallea aWHERE a.CHE_Codigo = 5900A Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-19 : 14:03:31
|
may be thisuse adn_coopemapUPDATE cd SET cd.CHE_Codigo = cc.COM_Codigo FROM CHD_Cheques_Detalle cdJOIN COM_Compania ccON cd.[CHE_Codigo 5900A] =cc.[COM_Codigo 1]GO |
 |
|
|
zeitoun
Starting Member
5 Posts |
Posted - 2008-09-19 : 14:56:13
|
quote: Originally posted by Vinnie881 This is basically just setting Checkes_Detail = 1, are you sure this is what you wantUPDATE aSET a.CHE_Codigo = b.COM_Codigo FROM CHD_Cheques_Detallea aCross JoinCOM_Compania bWHERE a.CHE_Codigo = 5900A and b.COM_Codigo = 1 If so useUPDATE aSET a.CHE_Codigo = 1FROM CHD_Cheques_Detallea aWHERE a.CHE_Codigo = 5900A Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881
ok really what I want is to update the table is called dbo.chd_cheques_detalle but to update this table and the corresponding row also update another table that there is a field that is not on the table if not on my table com_compania besides the basic problem is that need solving a problem with a check that had a code that now has to cambierce by a user entered the wrong code and the system willspelling Excuse me please |
 |
|
|
zeitoun
Starting Member
5 Posts |
Posted - 2008-09-19 : 14:56:13
|
quote: Originally posted by Vinnie881 This is basically just setting Checkes_Detail = 1, are you sure this is what you wantUPDATE aSET a.CHE_Codigo = b.COM_Codigo FROM CHD_Cheques_Detallea aCross JoinCOM_Compania bWHERE a.CHE_Codigo = 5900A and b.COM_Codigo = 1 If so useUPDATE aSET a.CHE_Codigo = 1FROM CHD_Cheques_Detallea aWHERE a.CHE_Codigo = 5900A Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881
ok really what I want is to update the table is called dbo.chd_cheques_detalle but to update this table and the corresponding row also update another table that there is a field that is not on the table if not on my table com_compania besides the basic problem is that need solving a problem with a check that had a code that now has to cambierce by a user entered the wrong code and the system willspelling Excuse me please |
 |
|
|
zeitoun
Starting Member
5 Posts |
Posted - 2008-09-19 : 15:10:13
|
quote: Originally posted by visakh16 may be thisuse adn_coopemapUPDATE cd SET cd.CHE_Codigo = cc.COM_Codigo FROM CHD_Cheques_Detalle cdJOIN COM_Compania ccON cd.[CHE_Codigo 5900A] =cc.[COM_Codigo 1]GO
use adn_coopemapUPDATE CHD_Cheques_Detalle SET CHD_Cheques_Detalle.CHE_Codigo = COM_Compania.COM_Codigo FROM CHD_Cheques_Detalle JOIN COM_Compania ON CHD_Cheques_Detalle.[CHE_Codigo 5900A] = COM_Compania.[COM_Codigo 1]GOerrors:Msg 207, Level 16, State 3, Line 3Invalid column name 'CHE_Codigo 5900A'.Msg 207, Level 16, State 3, Line 3Invalid column name 'COM_Codigo 1'. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-20 : 01:51:37
|
quote: Originally posted by zeitoun
quote: Originally posted by visakh16 may be thisuse adn_coopemapUPDATE cd SET cd.CHE_Codigo = cc.COM_Codigo FROM CHD_Cheques_Detalle cdJOIN COM_Compania ccON cd.[CHE_Codigo 5900A] =cc.[COM_Codigo 1]GO
use adn_coopemapUPDATE CHD_Cheques_Detalle SET CHD_Cheques_Detalle.CHE_Codigo = COM_Compania.COM_Codigo FROM CHD_Cheques_Detalle JOIN COM_Compania ON CHD_Cheques_Detalle.[CHE_Codigo 5900A] = COM_Compania.[COM_Codigo 1]GOerrors:Msg 207, Level 16, State 3, Line 3Invalid column name 'CHE_Codigo 5900A'.Msg 207, Level 16, State 3, Line 3Invalid column name 'COM_Codigo 1'.
ok. so you dont have columns CHE_Codigo 5900A... so where you trying update the column CHE_Codigo with 5900A,...Sorry it wasnt clear from your original post. Can you explain what you're really looking for. |
 |
|
|
zeitoun
Starting Member
5 Posts |
Posted - 2008-09-20 : 09:44:57
|
quote: Originally posted by visakh16
quote: Originally posted by zeitoun
quote: Originally posted by visakh16 may be thisuse adn_coopemapUPDATE cd SET cd.CHE_Codigo = cc.COM_Codigo FROM CHD_Cheques_Detalle cdJOIN COM_Compania ccON cd.[CHE_Codigo 5900A] =cc.[COM_Codigo 1]GO
use adn_coopemapUPDATE CHD_Cheques_Detalle SET CHD_Cheques_Detalle.CHE_Codigo = COM_Compania.COM_Codigo FROM CHD_Cheques_Detalle JOIN COM_Compania ON CHD_Cheques_Detalle.[CHE_Codigo 5900A] = COM_Compania.[COM_Codigo 1]GOerrors:Msg 207, Level 16, State 3, Line 3Invalid column name 'CHE_Codigo 5900A'.Msg 207, Level 16, State 3, Line 3Invalid column name 'COM_Codigo 1'.
ok. so you dont have columns CHE_Codigo 5900A... so where you trying update the column CHE_Codigo with 5900A,...Sorry it wasnt clear from your original post. Can you explain what you're really looking for.
ok is a need to update the table CHD_Cheques_Detalle a number of check n truth because in a program that does have one problem that a user entered a check estva already in the database and the system error could happen but now I leave when I Change my checking transactions problem of replica of what I want to check and replace with an update otherwise key fields in my project are the che_codigo and com_codigo but com_codigo belongs to a field that is not within dela table CHD_Cheques_Detalle if not this com_compania in the table and that is my issue that I can not update |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-21 : 02:16:50
|
| sorry not fully understood yet from your verbal explanation . can you illustrate with some sample data please? |
 |
|
|
|