Character limit to SQL select string

J

JimP

Is there a 255 character limit to the length of a SQL SELECT statement in
VBA, e.g.

strSQL="SELECT... (max 255 chars yes or no)"?
 
M

Marshall Barton

JimP said:
Is there a 255 character limit to the length of a SQL SELECT statement in
VBA, e.g.

strSQL="SELECT... (max 255 chars yes or no)"?


No, 64,000+ is the limit.

If you are stuffing an SQL string into a Row or Record
Source property, then the limit is 32,000+

(See Specifications in VBA Help)
 
J

JimP

Is there a "standardized" way to break up a long SQL select statement, given
that " _" does not function as a line continuation for a string. e.g.

strSQL1 = "SELECT....."
strSQL2 = "FROM........"
strSQL =strSQL1 & strSQL2
 
J

John Spencer

StrSQL = "SELECT Field1, Field2, Field3 " & _
"Field4, Field5" & _
" FROM NameYourPoison Inner Join" & _
" OtherTable On NameYourPoison.ID = OtherTable.FID" & _
" WHERE x = y"

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JimP said:
Is there a "standardized" way to break up a long SQL select statement,
given that " _" does not function as a line continuation for a string.
e.g.

strSQL1 = "SELECT....."
strSQL2 = "FROM........"
strSQL =strSQL1 & strSQL2
 
M

Marshall Barton

Two common styles:

strSQL = "SELECT..... " _
& "FROM........"
or

strSQL = "SELECT..... "
strSQL = strSQL & "FROM........"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Word Automation 3
Text String Length 2
String spanning multiple lines 3
What Character? 2
cell character limit 8
String Data Type 5
Continuous Form Control Setting (Select Case) 0
What's Wrong 1

Top