Results 1 to 3 of 3
This is more of a T-SQL question and for anyone who knows a lot about SQL, it's a very basic novice question so, bear with me
When looking at this ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-03-2009 #1Just Joined!
- Join Date
- Jun 2008
- Posts
- 17
SQL syntax question
This is more of a T-SQL question and for anyone who knows a lot about SQL, it's a very basic novice question so, bear with me

When looking at this statement:
IF DATEPART(dw, GETDATE()) = 7 OR DATEPART(dw, GETDATE()) = 1
PRINT 'It is the weekend.'
ELSE
PRINT 'It is a weekday.'
Why is there ()) after GETDATE? What is the purpose of the multiple ))'s?
- 06-03-2009 #2
GETDATE is a function so it requires the parenthesis as a function call. If you were to call GETDATE independently, it would just look like GETDATE(). So, the first closing paren closes the call to GETDATE. However, the result of this function call is passed as another paramater to the DATEPART function which requires 2 parameters. The second closing paren closes the call to DATEPART. Make sense?
- 06-03-2009 #3Just Joined!
- Join Date
- Jun 2008
- Posts
- 17
Yes, that makes a little more sense. Thanks.


Reply With Quote
