Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update not working
Message
De
16/08/2011 05:26:26
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01520808
Message ID:
01521074
Vues:
49
>>Hi
>>
>>any ideas why this is not working
>>
>>I know that @NewIndividualRef and @NewwJointIndividualRef have valid keys in them
>>I've printed them juts before the statement to check
>>The update doesn't produce an error code. If enter the update staement outside the stored procedure it work ok.
>>
>>Any ideas ?
>>
>>thanks
>>
>>begin try
>> update [test_nm].[dbo].[individual] set individual.family_ref = @NewIndividualRef where individual.individual_ref = @NewwJointIndividualRef
>>
>>end try
>>begin catch
>>
>> SELECT ERROR_NUMBER() AS ErrorNumber
>>end catch
>
>
>When you use full table name (OK, almost full :o))
>Better use alias or use the same name everywhere in the query
>
>begin try
>update [test_nm].[dbo].[individual] 
>        set family_ref = @NewIndividualRef
>where individual_ref = @NewwJointIndividualRef
>end try
>/* or
>
>begin try
>update [test_nm].[dbo].[individual]  individual
>        set individual.family_ref = @NewIndividualRef
>where individual.individual_ref = @NewwJointIndividualRef
>end try
>
>
>or 
>
>begin try
>update [test_nm].[dbo].[individual]
>        set [test_nm].[dbo].[individual].family_ref = @NewIndividualRef
>where [test_nm].[dbo].[individual].individual_ref = @NewwJointIndividualRef
>end try
>
>*/
>
>begin catch
>SELECT ERROR_NUMBER() AS ErrorNumber
>end catch
>
>
>BTW what this query gives you?
>
>SELECT * FROM [test_nm].[dbo].[individual]
>where individual_ref = @NewwJointIndividualRef
>
>Where @NewwJointIndividualRef has the same value as the UPDATE query?

Hi Boris

thanks for the tip.

I realised my problem was a typo on my part.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform