Last post Jun 10, 2012 03:58 PM by Mudasir.Khan
Jun 10, 2012 03:12 PM|Nilesh.P|LINK
Table Name Images
i need to write a stored procedure which will accomplish the following
Parameters @Image , @Receiptno
The stored procedure must first check for a Null value in Image1 and if value is null then insert @Image in Image1 where ReceiptNumber is @Receiptno . If Image1 is not null then @Image must be inserted in Image2 and so on.
Finally if all the 4 Image fields are full then it should return some error.
Any ideas on this?
Jun 10, 2012 03:58 PM|Mudasir.Khan|LINK
Declare IsError INT = 0
If Exists(Select 1 From Images(NOLOCK) Where Image1 IS NOT NULL AND Image2 Is not Null AND Image3 Is Not Null AND IMAGE4 IS not null And
ReceiptNumber = @Receiptno)
similarly check for each column and insert