Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query error in Genfare Interactive SQL

Status
Not open for further replies.

capronton

MIS
Jun 28, 2013
159
US
Can someone explain why I'm getting the error below?

Thanks.

[SQL]: select ts,tr.loc_n,bus,route,ttp,grp,des,seq,tpbc
from tr, ppd
where ts >= '2013-05-01 04:00:00.000' and ts <= '2013-06-01 03:59:00.000'
and tr.loc_n=ppd.loc_n
and tr.id-ppd.id
and tr.tr_seq=ppd.tr_seq
and ttp in (2)
and tpbc in (3)
order by ts
[Error]: SQLSTATE = 42000
Microsoft SQL Server Native Client 10.0
An expression of non-boolean type specified in a context where a condition is expected, near 'and'.

select ts,tr.loc_n,bus,route,ttp,grp,des,seq,tpbc from tr, ppd where ts >= '2013-05-01 04:00:
 
[tt]and tr.id[!]-[/!]ppd.id[/tt]

Looks like you a negative sign/symbol instead of equal symbol.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
How would I use the File>Save Data option to export the output to a text file? Could you give me an example of the syntax?

Thanks for catching the typo!
 
I know nothing about Genfare, sorry. I have seen the error "An express of non-boolean type" before, so I knew where to look for the error.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
How could I output the above select query to a text or excel file? Is there an 'SQL Statement' that would output the above select query to a text or excel file?
 
Using SQL Server Management Studio, you can set the output to be sent to a specific file...if the script is run by a job, you can set the job to output the results how you want. But as far as I know there isn't a 'SQL Statement' that does that. SQL manipulates and/or returns data....it doesn't provide a format...that's the job of the application doing the work.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Thank you.

Is there a bcp command 'bulk copy command' syntax that you can provide that would output the select query to a text file?
 
There is a SQLCMD command that may help. At the command line, type

SQLCMD -?

This will list the command line arguments for you. Hint: the command line arguments are case sensitive.



-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top