If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > First Date in the Month

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-04, 21:36
ad1k4r4 ad1k4r4 is offline
Registered User
 
Join Date: Apr 2004
Location: Jakarta, Indonesia
Posts: 3
Red face 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
Reply With Quote
  #2 (permalink)  
Old 04-14-04, 22:19
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
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
Reply With Quote
  #3 (permalink)  
Old 04-14-04, 22:28
ad1k4r4 ad1k4r4 is offline
Registered User
 
Join Date: Apr 2004
Location: Jakarta, Indonesia
Posts: 3
Thanks

Quote:
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 22:47.
Reply With Quote
  #4 (permalink)  
Old 04-14-04, 22:33
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On