Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

select cast help needed
What is the correct syntax for querying the first 20 characters of a
memo field?

I'm trying to
SELECT CAST (varchar(20) fieldname) as newfieldname
and i get a bunch of errors

Can someone please help me?

MS Access DB used with ColdFusion

Thanks

Report this thread to moderator Post Follow-up to this message
Old Post
T.M.
01-26-06 09:57 PM


Re: select cast help needed
I don't have access installed but, I think you can just use the left
function...

SELECT left(fieldName, 20) as newFieldName


Report this thread to moderator Post Follow-up to this message
Old Post
KenJ
01-26-06 09:57 PM


Re: select cast help needed
Thank you.
That works for one field. What if I wanted to get the first 20
characters from multiple fields? I'm trying to display the first few
lines of few articles. Each article has its own field in the db. Any ideas?


KenJ  wrote:
> I don't have access installed but, I think you can just use the left
> function...
>
> SELECT left(fieldName, 20) as newFieldName
>

Report this thread to moderator Post Follow-up to this message
Old Post
T.M.
01-26-06 09:57 PM


Re: select cast help needed
On Wed, 25 Jan 2006 20:39:45 -0500, T.M. wrote:

>What is the correct syntax for querying the first 20 characters of a
>memo field?
>
>I'm trying to
>SELECT CAST (varchar(20) fieldname) as newfieldname
>and i get a bunch of errors
>
>Can someone please help me?
>
>MS Access DB used with ColdFusion
>
>Thanks

Hi T.M.,

For Access help, you might want to post to an Access group. This group
is for SQL Server. :-)

In SQL Server, you'd use

SELECT CAST(fieldname AS varchar(20)) AS newfieldname FROM tablename

I have no idea how well that would port to Access.

--
Hugo Kornelis, SQL Server MVP

Report this thread to moderator Post Follow-up to this message
Old Post
Hugo Kornelis
01-26-06 09:57 PM


Re: select cast help needed
T.M.  (iamcarterwells@yaho
o.com)  writes:
> Thank you.
> That works for one field. What if I wanted to get the first 20
> characters from multiple fields? I'm trying to display the first few
> lines of few articles. Each article has its own field in the db. Any
> ideas?

comp.databases.ms-access


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
01-26-06 09:57 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 04:04 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006