Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6094785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:43:13+00:00 2026-05-23T12:43:13+00:00

i can write the stored procedure delete the row in table based on date

  • 0

i can write the stored procedure delete the row in table based on date

create proc uspInvoicePaymentsdelete3
@PaymentDate datetime
as
begin
delete from tblInvoicePaymentDetails where PaymentDate=@PaymentDate
end

but row not deleted i am sending parameter value is ‘6/15/2011 3:40:18 PM’ but It taking 24hours format in my sql server2005 so no rows are deleted how to change the dates.(table date format and parameter date is same format but stored procedure converting 24 hr format)

 delete from tblInvoicePaymentDetails where PaymentDate='6/15/2011 3:40:18 PM'

but my requirement is datetime consider secounds also ,

  • problem is i am sending parameter date and database date both same but output is no rows deleted what is the problem and how to write the stored procedure

Pls give me correct solution

      Name            Date           amount  id
    hemanth 6/15/2011 3:40:18 PM    100 1003
    hemanth 6/15/2011 3:40:42 PM    100 1003

Thanking u
hemanth

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:43:13+00:00Added an answer on May 23, 2026 at 12:43 pm

    The problem may be related to the fact that, as @Andrew has pointed out in his comment to your question, datetime values in your table contain milliseconds also, while you are passing the value that doesn’t contain milliseconds.

    If that is so, you could change the WHERE clause of you DELETE statement like this:

    WHERE PaymentDate >= @PaymentDate
      AND PaymentDate < DATEADD(second, 1, @PaymentDate)
    

    Note, though, that this may lead to deleting more than one row. For example, you have data as follows:

    Name    PaymentDate             amount id
    ------- ----------------------- ------ ----
    …       …                       …      …
    hemanth 2011-06-15 15:40:18.550 100    1003
    hemanth 2011-06-15 15:40:18.987 100    1003
    hemanth 2011-06-15 15:40:42.363 100    1003
    …       …                       …      …
    

    If we ignore milliseconds, then there are two rows here with the same value of PaymentDate. Maybe, a situation like this is impossible with your application and so you needn’t worry about that. I just wanted to make sure that you were aware that, technically, it could be possible to delete more than one record when you are using an incomplete date/time value as a parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a stored procedure to insert a row into a table.
my goal is to write a stored proc that can collect all field values
We have an stored procedure that we created so that user can write comma
We have an stored procedure that we created so that user can write comma
I'm trying to write a stored procedure to copy a subset of data from
I am trying to write a stored procedure that will allow me to write
I'm trying to write a stored procedure that will have 6 bit value flags
I write a stored procedure for most viewed photos in my procedure, this is
Is it possible to write a stored procedure or trigger that will be executed
I am trying to write a stored procedure in MySQL which will perform a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.