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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NVARCHAR

Status
Not open for further replies.

Ringers

Technical User
Feb 26, 2004
180
AU
Hi I trying to do a select query where a NVARCHAR column is equal to a 9 digit number, but it is returning an error.

Error:

An expression of non-boolean type specified in a context where a condition is expected, near 'Account'.

Table:Bulkpay_OperatorAccounts

Columns:
User Id (nvarchar(16),null),
Contra Account BSB (nvarchar(6),null),
Contra Account Number(nvarchar(20),null),
Access Given (Bit, not null),
Signature (nvarchar(8),null),

Query:

SELECT *
FROM Bulkpay_OperatorAccounts
WHERE Contra Account Number = '012003-837391956'

Any help would be great, thanks.

 
You should round every column or table name that have spaces in it or some keywords are used with square brackets:
Code:
SELECT *
FROM Bulkpay_OperatorAccounts
WHERE [Contra Account Number] = N'012003-837391956'

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
ah wow never seen that before, thanks.
 
It is best to never design tables with spaces, non-alpahnumeric characters (except _) or database keywords. This willl save a lot of debugging for issues like this.

"NOTHING is more important in a database than integrity." ESquared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top