Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Location
    Jakarta, Indonesia
    Posts
    3

    Red face Unanswered: First Date in the Month

    I have a question about creating view for these coloum and have a lot trouble, before that I describe my tables :

    Table A :
    Code as nvarchar
    Ammount1 as money
    Date as datetime -> transaction date
    primary key are Code and Date1

    Table B :
    Code as nvarchar
    Ammount2 as money
    Date as datetime -> transaction date
    primary key are Code and Date2

    I like joining this table and create table/view that result :

    Code | Amount1 Today | Amount2 Today | Amount1 Last Year | Amount1 Month to date (Sum from first day month till today) | Amount2 month to date | Amount1 Last Year month to date

    The parameter only for @Date.

    First I have problem to get queries specially for first date in the month, I used CAST but it doesn't work, then I used CONVERT and CAST still doesn't work.

    Anybody help me ?
    Thx a lot.
    ad1k4r4

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You can't pass an argument to a SQL view. You probably want to use a stored procedure if your database engine supports them.

    -PatP

  3. #3
    Join Date
    Apr 2004
    Location
    Jakarta, Indonesia
    Posts
    3

    Thanks

    Originally posted by Pat Phelan
    You can't pass an argument to a SQL view. You probably want to use a stored procedure if your database engine supports them.

    -PatP
    Last edited by ad1k4r4; 04-14-04 at 23:47.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I know that Tony (the SQL Forum moderator) likes to keep this forum free of database engine specific discussions, and I think this particular discussion may be long. This has really become a thread that belongs in the SQL Server Forum. I'll be happy to pursue it there (as will many other people)!

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •