Solved

Visual Studio Visual Basic Select Statement

Posted on 2007-03-22
4
208 Views
Last Modified: 2013-11-26
Hello All,

               Have this line of code below

Dim strSql As String = "SELECT Sum(fromadvtodaytxt) FROM Settlement Where SettlementDatetxt is not null and (CONVERT(Char(6), SettlementDatetxt, 112) = CONVERT(Char(6), GETDATE(), 112))"

Needing to add where it also checks the current year-if you can help?

Thanks JK
0
Comment
Question by:fsuedu
  • 3
4 Comments
 
LVL 21

Expert Comment

by:theGhost_k8
Comment Utility
try this convert(varchar(4), datepart(year, getdate()))
0
 

Author Comment

by:fsuedu
Comment Utility
Getting a syntax error

can you see whats wrong?

SELECT Sum(fromadvtodaytxt) FROM Settlement Where SettlementDatetxt is not null and (CONVERT(Char(6), SettlementDatetxt, 112) = CONVERT(Char(6), GETDATE(), 112)) and (CONVERT(varChar(4), SettlementDatetxt, 112)convert(varchar(4), datepart(year, getdate())))"

Thanks JK
0
 
LVL 21

Expert Comment

by:theGhost_k8
Comment Utility
xt, 112)convert(va
            /\
no space??
0
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 500 total points
Comment Utility
=
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now