Hi,
I am using cursor to update one table from another table and this my script :
Declare @Recid bigint
Declare @ProdName nvarchar(100)
Declare @ProdComm nvarchar(100)
Declare @ProdConcat nvarchar(100)
Declare ProductName CURSOR FOR
SELECT REPLACE(SUBSTRING(DISPLAYPRODUCTNUMBER,8,20),':','-')
,B.RECID ,[NAME]
FROM [AKSAX].[dbo].[ECORESPRODUCT]AS B,[AKSAX].[dbo].[ECORESPRODUCTTRANSLATION] AS A
WHERE B.RECID=A.RECID
AND CONVERT(INT,SUBSTRING(DISPLAYPRODUCTNUMBER,1,1)) > 1
Open ProductName
Fetch Next From ProductName into @ProdComm,@Recid ,@ProdName
While (@@FETCH_STATUS =0)
Begin
SET @ProdConcat = @ProdName + ' ' + @ProdComm
BEGIN
UPDATE [AKSAX].[dbo].ECORESPRODUCTTRANSLATION SET DESCRIPTION = @ProdConcat
WHERE RECID = @Recid
END
Fetch Next From ProductName into @ProdComm,@Recid ,@ProdName
End
PRINT 'This Update is Finished'
close ProductName
DEALLOCATE ProductName
But I am not get all the records updated probably .
Best regards
Jamil