Multi line Select Query
Hi,
I have a problem i have a select statement which is about 20 od lines and i'm trying to retrive data from the database but the proble is that it gives me a error. can anyone tell me how to link a multilin select statement into one in VB. thank -- Message posted from http://www.ExcelForum.com |
Multi line Select Query
If it is more than 255 characters in length, you need to break the parts of
it into an array. Use the macro recorder to do an msquery query (Data=Get External Data) using a similar long query string and you will see how the array is constructed. -- Regards, Tom Ogilvy "madhan " wrote in message ... Hi, I have a problem i have a select statement which is about 20 odd lines and i'm trying to retrive data from the database but the problem is that it gives me a error. can anyone tell me how to link a multiline select statement into one in VB. thanks --- Message posted from http://www.ExcelForum.com/ |
Multi line Select Query
A SQL statement is a single string. If it has contains line breaks
then these will be for ease of reading by a human. If you are putting line breaks into code to make it easier to read, ensure you include spaces between words e.g. strSql = "SELECT Col1, Col2" & _ "FROM MyTable" ' <-error strSql = "SELECT Col1, Col2" & _ " FROM MyTable" ' <-correct If by multi-line you mean 20 SQL statements e.g. separated by semicolons, you will need to send each statement one by one, but you could do this in a batch so the RDBMS can optimize execution. -- madhan wrote in message ... Hi, I have a problem i have a select statement which is about 20 odd lines and i'm trying to retrive data from the database but the problem is that it gives me a error. can anyone tell me how to link a multiline select statement into one in VB. thanks --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 01:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com