Share : We the People: Consenting to a Deeper Democracy by John Buck and Sharon Villines with ISBN 9781597713264.Q:
When deleting a row from a table in SQL server how to prevent deleting rows with values with a default value?
I have the following table. I am using SQL server 2012.
I need to know how to identify in the above table in which cases the delete statement failed, it should not have executed because of the values of 'Total Life' and 'Maximum Drive Life' having default value.
Is there any way to achieve this?
A:
You should insert a column called status with default value 0
The update statement should be like this
update Table
set status = 1
from
(
select * from table
) as temp
where
(
(select 1 from [your table] where [your table].status = 0)
)
and [your table].Total_Life = 'Value1'
and [your table].Maximum_Drive_Life = 'Value2'
and
(
(select 1 from [your table] where [your table].status = 0)
)
and delete statements should have a where clause to check status of the rows with status = 0
Q:
AWS SQS: How to delete a message in an SQS queue?
I am trying to delete a message from an SQS queue, but I am not able to get it done.
Following is the code for deleting a message from the queue:
>>> msg = sqs.get_message(QueueUrl=''+SQS_QUEUE, Id=message_id)
>>> msg.delete()
but I am getting following error
The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
A:
You have to specify your secret key when creating the message. It's not enough to make an HTTP POST to a queue in SQS.
In order to delete a message you should also specify the original message ID that you want to delete.
Something like the following should work:
>>> message_id = "theMessageIDyouWantToDelete"
>>> msg = sqs.get_ ac619d1d87
Related links:
Commentaires