C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » SQL Server »

Plz verify my select query


Posted Date: 21 Nov 2008      Posted By: rahul      Member Level: Silver     Points: 1   Responses: 5



SELECT invoicedate,projectname from invoice where invoicedate=(mm,getdate())
i m getting an error incorrect syntax





Responses

Author: greeny_1984    21 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 3

i guess if u want to get only month part in u r date

u can use this

DATEPART(month, GETDATE())

books online option in sql sevrer 2000 provides info about all the

sql server related questions,u can check that for further info

Regards,
Greeny_1984

Rate this Response[Excellent/Good/Poor]
FRESHERS check this link
Need help from me join here



Author: Anil Kumar Pandey    21 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 3

hi,

What are u storing in the INVOICEDATE column, if month then select somt from ghet date else use the getdate as it is..


like

SELECT invoicedate,projectname from invoice where invoicedate=getdate()



Regards
Anil pandey

Thanks & Regards
Anil Kumar Pandey



Author: saisrikanthreddy    21 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 3

Hey Rahul

what is Invoicedate = 9mm,getdate()). what you need to compare? Explain it clearly. so we can give the solution.

***********
Regards,
SaiSrikanthReddy



Author: Deepika Haridas    21 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 1

Check here

http://www.sql-server-helper.com/tips/date-formats.aspx



Thanks & Regards,
Deepika
Editor

If U want to shine like a SUN..First U have to burn like the SUN!!
Need a Guide? Join my mentor program..



Author: Sriman N Vangala    21 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 4

Assuming that your requirement is to get all the invoicedate and Projectname details from the invoice table for a prticular month i.e the current month. then you can make use of the following query :

SELECT invoicedate,projectname from invoice where
datepart(mm,invoicedate)=month(getdate())



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Suggestion needed for select query
Previous : datetime in sql
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use