SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO
Alter proc usp_UpdateWorksheet @PropMCName as varchar(50)=NULL as
Set XACT_ABORT ON
declare @propid varchar(100) declare @sid varchar(100)
Exec(' DELETE FROM OPENROWSET(''SQLOLEDB'',''' + @PropMCName + ''';''sa'';''mypwd'',''SELECT * FROM NV.dbo.Worksheet'') INSERT INTO OPENROWSET(''SQLOLEDB'',''' + @PropMCName + ''';''sa'';''mypwd'',''SELECT [wLockNumber], [wControlID], [wControlIndex], [wControlCaption], [wRequire], [wLeft], [wTop], [wHeight], [wWidth], [wTabStop], [wTabOrder] FROM NV.dbo.Worksheet'') SELECT [wLockNumber_err], [wControlID], [wControlIndex], [wControlCaption], [wRequire], [wLeft], [wTop], [wHeight], [wWidth], [wTabStop], [wTabOrder] from test_worksheet ')
if @@error<>0 begin goto lblErrorEnd end
Print 'Updated.....' + @PropMCName goto lblSuccessEnd
lblErrorEnd: Print 'Error While Updating.....' + @PropMCName
lblSuccessEnd:
GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO |