|
If i have an access database with a table called "USER" with fields ID, AGE, NAME, ADDRESS, and i want address of all users with age = 23, a simple sql query will do (SELECT * FROM USER WHERE blah blah)..
But when I have data in a CSV File, how would i build this sql query? select * from what?
Any help or pointers in this direction is highly appreciated.
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Rajesh R. Subramanian wrote: But when I have data in a CSV File, how would i build this sql query? select * from what?
Hi Rajesh,
csv file is nothing, just a comma seperated data and whole line denotes a record.
for executing query AFAIK, you have to import that in access and proceed in similiar way you mentioned above.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi Alok,
ThatsAlok wrote: csv file is nothing, just a comma seperated data
Thanks for your reply, but I too know its Comma separated text data. My concern is that it would be faster to use CSV instead of Access database.
ThatsAlok wrote: you have to import that in access and proceed in similiar way you mentioned above.
Dude, I have exported values from Access and created the CSV because it would be faster. You are asking me to create a MDB out of it again
Best Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Rajesh R. Subramanian wrote: created the CSV because it would be faster.
How Come ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Rajesh is correct.
1. Create a CSV file by exporting 10000 records.
2. Perform data operation on your MDB and CSV file.
3. You will surely find csv to be faster since it is text based.
|
|
|
|
|
hi,
Use OpenRowSet for performing data operations on .CSV files. I do not know if you could edit data, but you could query for sure.
-- modified at 0:48 Thursday 29th December, 2005
|
|
|
|
|
Thank you so much. That was the keyword I was looking for.
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Hai,
CSV is just a text file...You cannot perform any operations on that.
I think you have to Convert that text File in Table/Excel Format..
For this ..first you have to check ...
1.weather your file is variable length/Fixed length....
(...means weather your file is following any format..or not)
2.How it is parsed...(with coma,semicolon, space,tab etc)
VamsiDhar.MBC
SoftwareEngineer
|
|
|
|
|
mbcvamsidhar wrote: CSV is just a text file...You cannot perform any operations on that.
Sir, it is possible to perform operations on that. Atleast query operations. This can be done by using the xls driver. (select * from Sheet1 where blah blah).
mbcvamsidhar wrote: 2.How it is parsed...(with coma,semicolon, space,tab etc)
CSV = Comma separated values. Parsed with comma.
Regards and Thanks
Rajesh R. Subramanian.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Sir, it is possible to perform operations on that. Atleast query operations. This can be done by using the xls driver. (select * from Sheet1 where blah blah).
Can you Give me the syntax ....how to connect..etc
Thanks and Rgds
VamsiDhar.MBC
SoftwareEngineer
|
|
|
|
|
You can use the ODBC Text file driver to query the csv directly. However, it only gives you read access to the csv.
onwards and upwards...
|
|
|
|
|
Yes master,
I am using the same. But what would be the sql query format? SELECT * FROM what WHERE ...
Thanks and Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Example assumes that the CSV file is C:\Data\MyData.csv:
select * from C:\Data\MyData.csv
Also, using the ODBC DSN config utility, you can define the names and data types of the columns in the file. If you do this, you can access the column names in your sql statement and get back converted data types. Otherwise, I believe it just returns columns named F1, F2, F3, etc, all being varchar(255).
onwards and upwards...
-- modified at 9:44 Thursday 29th December, 2005
|
|
|
|
|
Hai,
Iam developing VC application which Selects any .MDB Database(MS-Access).
The requirement is..My Application should popup the list of Tables which contains primaryKey.
Can you pls tell me how to the retreive each table information in Access. (From MS-SQL i acheived this..using SQLGetPrimaryKeys()).....!
But this API is not Supporting For Access...
VamsiDhar.MBC
SoftwareEngineer
|
|
|
|
|
Hi,
I looked at the asm code in VC Disassembly for the following codes:
i++;
i = i+1;
Both are same.
10: i++;
0040D75F mov eax,dword ptr [ebp-8]
0040D762 add eax,1
0040D765 mov dword ptr [ebp-8],eax
11: i = i+1;
0040D768 mov ecx,dword ptr [ebp-8]
0040D76B add ecx,1
0040D76E mov dword ptr [ebp-8],ecx
But I studied in my computer classes that i++ is faster than = i+1.
How?
Thank you.
- NS -
|
|
|
|
|
it depends on the context.
like for example
k = somefunctioncall(i+1);<br />
i = i +1;
or
k = somefunctioncall(++i);
so here the secound one is faster than the first one
-Prakash
-Prakash
-- modified at 6:22 Wednesday 28th December, 2005
|
|
|
|
|
It has been a while since I did any C++ admitidly, I'm sure that the second example will pass a difference value into somefunctioncall because i++ is a postfix operation, i is passed into the function then updated, while i+1 will evaluate first then get passed into the function.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
yeah i know, I made the mistake
Thanks
<hr<span style="color:gray;size:15px;">-Prakash
-Prakash
|
|
|
|
|
Mr.Prakash wrote: Thanks
-Prakash
-Prakash
is my vision get blurred
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
The asm is
11: ++i;
0040D788 mov ecx,dword ptr [ebp-8]
0040D78B add ecx,1
0040D78E mov dword ptr [ebp-8],ecx
12: i = i+1;
0040D791 mov edx,dword ptr [ebp-8]
0040D794 add edx,1
0040D797 mov dword ptr [ebp-8],edx
13: fun(i+1);
0040D79A mov eax,dword ptr [ebp-8]
0040D79D add eax,1
0040D7A0 push eax
0040D7A1 call @ILT+5(fun) (0040100a)
0040D7A6 add esp,4
14: fun(++i);
0040D7A9 mov ecx,dword ptr [ebp-8]
0040D7AC add ecx,1
0040D7AF mov dword ptr [ebp-8],ecx
0040D7B2 mov edx,dword ptr [ebp-8]
0040D7B5 push edx
0040D7B6 call @ILT+5(fun) (0040100a)
0040D7BB add esp,4
15: fun(i++);
0040D7BE mov eax,dword ptr [ebp-8]
0040D7C1 mov dword ptr [ebp-0Ch],eax
0040D7C4 mov ecx,dword ptr [ebp-0Ch]
0040D7C7 push ecx
0040D7C8 mov edx,dword ptr [ebp-8]
0040D7CB add edx,1
0040D7CE mov dword ptr [ebp-8],edx
0040D7D1 call @ILT+5(fun) (0040100a)
0040D7D6 add esp,4
There are more instructions where ++ operator is used. Then how can we say that ++ is faster?
- NS -
|
|
|
|
|
U r wrong the case is vice versa
Tough to Belive
Assembly code to prove my observations
<br />
507: Add(++i);<br />
004010CE mov eax,dword ptr [ebp-4]<br />
004010D1 add eax,1<br />
004010D4 mov dword ptr [ebp-4],eax<br />
004010D7 mov ecx,dword ptr [ebp-4]<br />
004010DA push ecx<br />
004010DB call @ILT+15(Add) (00401014)<br />
004010E0 add esp,4<br />
508: Add(i+1);<br />
004010E3 mov edx,dword ptr [ebp-4]<br />
004010E6 add edx,1<br />
004010E9 push edx<br />
004010EA call @ILT+15(Add) (00401014)<br />
004010EF add esp,4<br />
506: Add(1+i);<br />
004010CE mov eax,dword ptr [ebp-4]<br />
004010D1 add eax,1<br />
004010D4 push eax<br />
004010D5 call @ILT+15(Add) (00401014)<br />
004010DA add esp,4<br />
507: Add(i++);<br />
004010DD mov ecx,dword ptr [ebp-4]<br />
004010E0 mov dword ptr [ebp-5Ch],ecx<br />
004010E3 mov edx,dword ptr [ebp-5Ch]<br />
004010E6 push edx<br />
004010E7 mov eax,dword ptr [ebp-4]<br />
004010EA add eax,1<br />
004010ED mov dword ptr [ebp-4],eax<br />
004010F0 call @ILT+15(Add) (00401014)<br />
004010F5 add esp,4
AS far as i think this is compiler dependent
i dont know the reason
But this is surely true if we pass some object in function
as lots of mechanismis involved to create and destroy object
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
SomeFunc(i+1)
is NOT the same as
SomeFunc(++i)
because in the first case, you do NOT modify the value of i .
I think you missed that, as the argument degraded over time...
It started
i = i + 1;
and
i++;
or
++i;
all of which will modify the value of i
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Can u also tell how did ur computer teacher
said it was fast .
(There is always have a question HOW ?)
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
It was about ++ uses inc instruction...
- NS -
|
|
|
|
|
Yeh ur absolutely right there is a INC
machine instruction but unfortunalty
our vc++ compiler dont use it .
Might be it is not a part of 486 instructin set
or we dont know how make the compiler use it .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
-- modified at 6:34 Wednesday 28th December, 2005
|
|
|
|
|