Showing posts with label previous. Show all posts
Showing posts with label previous. Show all posts

Monday, March 19, 2012

How to add the total balances of previous year into the next year?

I'm working with a table called SALFLDGAMS where it has two columns that I need to work with. One of the columns is Period which has years from 2000 to 2005 and the other column is called amount which has the balance for that year. Let me explain in a little more detail. There are account codes associated with the years as well so there will be many places where for example the year 2000 will show up with a given value. What I'm trying to do is to create a view which has a BeginBalance column which adds lets say all the values for 2000 and sticks them to 2001. So what I'm saying is all the values from the previous year I want them in the current year. All in one column. Thanks for the help guys.can you post your table structure, some sample data and the result you want ?|||Ok, I will post the structure of the table and the structure of the view that I want.|||

SALFLDGAMS Table:

Acc_Code Period Amount
11500 2000 234
11511 2000 345
11500 2000 223

NewView:

Acc_Code Period BeginBalance
11500 2001 457

I want a new view based on the SALFLDGAMS table that shows the begin balance for example 2001 that comes from the total amount Sum of 2000.

|||

Hello there:

SELECT Acc_code, CONVERT(int, Period) + 1 AS PeriodNext, SUM(Account) AS PreBalance
FROM dbo.myAccount
GROUP BY Acc_code, Period

|||what happens if I have to keep Period as Varchar? How could it do it then?|||

From reading your other questions about this, you can modify your query to reach your goal.

Suppose your period column is Varchar column in this format: 20020101

SELECT Acc_code, (CONVERT(int, Left(Period,4)) + 1) AS PeriodNext, SUM(Account) AS PreBalance
FROM dbo.myAccount
GROUP BY Acc_code, Period

|||Thanks for the help guys!

Friday, March 9, 2012

How to add existing dtsx file back into VS project

I recently did a save as for my ssis project in VS. Now when I open my sln file, it doesn't show the previous package name, it shows the new name. This is not what I want. I thought that doing a save as would separate the new package name into it's own project.

I removed that package name from my solution explorer and tried to add back in the old dtsx filename under SSIS packages in Object Explorer. I did a right click on SSIS Packages and choose "add existing package", chose the old dtsx file. It created a whole new filename with (1).dtsx appended to it.

How can I get this project back where it used to be? I'm using VS 2005

It sounds like your package may be in the source control system already when you try to re-add it. Have you tried to right-click on the project and selecting Get Latest Version? That will ensure that you're in synch with VSS and then you could do you rename after you have that release.

-- Brian Knight

|||

When you do save as, it also changes the name in the solution, yes. The old package is still there, just right click on the project node and select Add Existing Package like you said, but then just rename the package when you load it.

K

Friday, February 24, 2012

How to add a date range of drop down list for a SQL query?

Hi All,
I'm trying to create a report that let the user select the date range (such
as previous month, YTD, Oct, Nov,Dec, etc.). I know that I need to create a
SQL query like "select * from MyTable where selectdate between @.FromDate and
@.ToDate", but there are 2 parameters, but the date range drop down list just
have one parameter (For example, @.SelectDate), how could I pass the
@.SelectDate value to the @.FromDate and @.Todate?
I tried to search the MSDN but could not get the answer? Anyone could help?
Sample are appreciated if has.
Thanks a lot.
BillUse 2 comboboxes, one for the @.From another for the @.To date each with their
proper dataset:
- For @.From use something like "select mydates from dimTime ... "
- For @.To use something like "select mydates from dimTime where dates>=@.From
..."
(pseudo-code, you get the idea)
hth,
Tom
"Bill" wrote:
> Hi All,
> I'm trying to create a report that let the user select the date range (such
> as previous month, YTD, Oct, Nov,Dec, etc.). I know that I need to create a
> SQL query like "select * from MyTable where selectdate between @.FromDate and
> @.ToDate", but there are 2 parameters, but the date range drop down list just
> have one parameter (For example, @.SelectDate), how could I pass the
> @.SelectDate value to the @.FromDate and @.Todate?
> I tried to search the MSDN but could not get the answer? Anyone could help?
> Sample are appreciated if has.
> Thanks a lot.
> Bill
>