Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update not working
Message
 
To
12/08/2011 05:15:04
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01520808
Message ID:
01520810
Views:
34
>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?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform