Jump to content

Recommended Posts

Posted (edited)

SELECT ProcedureID,BatchDate,ServiceDate,ProcedureDescription,Amount,BillingProviderID
FROM dbo.PbrChargeTransactions
WHERE BillingProviderID = 'SEU.JO'
and ServiceDate Between '2016-01-01 and 2016-12-31'
and Amount > '0'
ORDER BY ServiceDate

 

I am using 2012 server and was wondering why my > sign is not working?

I get 

Msg 102, Level 15, State 1, Line 5
Incorrect syntax near '>'.

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Posted

I figured it out the problem was here

and ServiceDate Between '2016-01-01 and 2016-12-31'  - Wrong

and ServiceDate Between '2016-01-01' and '2016-12-31'  - Right

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Posted

I know nothing about SQL but shouldn't be

and Amount > '0'

changed to

and Amount > 0

for a numeric comparison?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I know close to nothing. I am just starting to pick it up again. I tried it both ways and it works. I wonder if there is a downside to eitherway. 

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Posted
  On 1/10/2017 at 10:40 PM, SkysLastChance said:

I wonder if there is a downside to eitherway. 

Expand  

I think the string comparison converts the character to its decimal equivalent before comparing... just a guess, I have not done any SQL

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...