Archived

This topic is now archived and is closed to further replies.

Access SQL Problem...

This topic is 5599 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

hi.. /*Postcode is a numeric data type by default*/ SELECT CAST(Postcode AS CHAR(5)) FROM Person; i wanted to cast or convert Postcode from numeric data type to char or text data type... however it stated an error which is: Syntax error (missing operator) in query expression CAST(Postcode AS CHAR(5))''. But by default it should work... anyway anyone can help or fix this error? Thanks A LOt... :-)

Share on other sites
CAST is only good for converting between different numeric types (and dates/times). You don''t have to do anything special to get numeric types to act like strings, though (or vise versa for that matter). For example, the following:

SELECT CONCAT( ''This is a number: '', 1234 )

Would return "This is a number: 1234" as expected.

If I had my way, I''d have all of you shot!

codeka.com - Just click it.

Share on other sites
CONCAT doesn''t work for Microsoft Access SQL....

Share on other sites

This may be no help - I know this is how to do it in Microsoft SQL - but as for Access... afraid I don''t have it installed (cos it is just above "Mostly Useless" for databases... )

Share on other sites
wheres the table you are selecting

just a thought

Share on other sites
SELECT CStr([person]![postcode]) AS postcode
FROM person;

try that!

Share on other sites
THANK!

SELECT CStr([person]![postcode]) AS postcode
FROM person;

WORK!

by the way where can i find a complete SQL reference for microsoft acess which tell me what kind of SQL syntax can be use in it....
i know they are using mircosoft jet SQL in acess....
so any reference, e-book or web site....????

Thanks alot...

:-)

Share on other sites
Try here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.asp

"It is precisely because it is fashionable for Americans to know no science, even though they may be well educated otherwise, that they so easily fall prey to nonsense. They thus become part of the armies of the night, the purveyors of nitwittery, the retailers of intellectual junk food, the feeders on mental cardboard, for their ignorance keeps them from distinguishing nectar from sewage."
Isaac Asimov

• Forum Statistics

• Total Topics
628742
• Total Posts
2984478

• 12
• 25
• 12
• 10
• 17