Results 1 to 4 of 4

Thread: Trying to capture a very long SQL string in a VBA string

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Newbie tcarnahan's Avatar
    Joined
    Jul 2007
    Location
    Fairfax
    Posts
    4
    Location
    Thanks Sam!

    I am trying to store the SQL in a "template" PT query that I have saved because it has so many parts (unions, pivot, etc.), so what I would have to do is use:

    strSql1 = LEFT(qdf.SQL, x)     'where x is the number of characters
    strSql2 = MID(qdf.SQL, y,z)    ' where y is "x+1" and z is so many characters
    strSql3 = Right(qdf.SQL, LEN(qdf.SQL) - y + z)  
    
    strSqlNEW = strSql1 & strSql2 & strSql3
    I thought a "string" data type could take 2 billion characters. Was I mistaken? If it is only 255, then even the code (above) would not work when I concatenate the 3 parts. My SQL is about 3,000 characters.
    Last edited by tcarnahan; 11-26-2013 at 08:21 AM. Reason: Left out [code]
    -- Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •