Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

Im having table with data like this

Date Amount
2013-12-02 -500
2013-12-05 100
2013-12-07 50
2013-12-09 -20
2013-12-18 400

My requirement is

2013-12-02 -500
2013-12-03 -500
2013-12-04 -500
2013-12-05 -400
2013-12-06 -400
2013-12-07 -350
2013-12-08 -350
2013-12-09 -370
2013-12-10 -370
2013-12-11 -370
2013-12-12 -370
2013-12-13 -370
2013-12-14 -370
2013-12-15 -370
2013-12-16 -370
2013-12-17 -370
2013-12-18 30

(ie) I need to place amount for each date based on above table.

Tell me some solutions.
Posted
Updated 29-Jan-14 20:18pm
v2
Comments
Sibasisjena 9-Jan-14 7:27am    
Can you please tell me what is you column type in the database.
Sibasisjena 9-Jan-14 7:28am    
I think you need to convert the date format in your application. No need to do any thing in the Database. In the application where you are assigning the value,there itself you have to convert it.
kirthiga S 9-Jan-14 23:48pm    
Date format is not my query. My requirement is to calculate the amount on day basis.

1 solution

I just hope for the sake of sanity that the date field in the table is of date type or maybe datetime type.
Then there's nothing to do. The rendering of the data should not be done on the SQL-Server, but rather on the client.
There is never a reason for doing this on the server as it will severely hinder you in introducing different formats later on.
Let the application worry about formatting the date correctly.

Regards,
— Manfred
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900