|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Accessing related fields with stored procedure
Hi I have a problem I got a stored procedure to delete the rows of three related tables. But when i use the procedure without multiple occurances of the related fields i am successfully running this procedure....And when i create duplicate rows in the related table my procedure is giving error can any one correct my procedure and i have to take a field instead of ID that is when i call the delete procedure i have to take mapname instead of maptointernalid and mapfrominternalid which are related to MapID and inturn gives the MapName. Please anybody help I am so confused My procedure as follows . The error occurs here (indicated with this sign "=>") CREATE PROCEDURE SP_Delete_DocumentTypeInstance2 ( @MaptoInternalID int, @MapfromInternalID int, @DocumentTypeInstanceID int ) AS Set nocount on Declare @MapID int select @DocumentTypeInstanceID=(select DocumentTypeInstanceID from OrganizationDocumentType where DocumentTypeInstanceID=@DocumentTypeInstanceID) => select @MapID=(select MaptoInternalID from DocumentTypeInstance where MaptoInternalID=@MaptoInternalID) Delete from OrganizationDocumentType where DocumentTypeInstanceID=@DocumentTypeInstanceID Delete from DocumentTypeInstance where MaptoInternalID=@MapID Delete from Map where MapID=@MapID set nocount off GO thanks in advance sai11 |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Accessing related fields with stored procedure |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|