Export WL data to SQL
Author: falcon82
Creation Date: 3/29/2013 9:53 AM
profile picture

falcon82

#1
Hello,

I try to export the WL data to a SQL database. There is no problem to export the WL data to csv files (see wiki). After that I tried to use the following script for the SQL export:

I did everything like described in the wiki. I set up the database with the values (except in MS SQL 2012 Express there is no varchar(10) so I used varchar(50) instead).

But I get an error. I debugged the code and there seems to be an error in the following code:
// Add the other columns (DOHLCV+custom series)
CODE:
Please log in to see this code.

I get the error that the column 9.4525 (AdjClose from the AA symbol) already exits because it is the the same value as the close. I tried to delete the values in the column from the csv (just the values, so I left the column empty whats alright because in the database the column is nullable) and the error disappeared. But this is not meant to be like this, right? Can anybody help me with that error?

The second error appeared nearly at the end of the script. I get the a Runtime Error that - the value of type string from the csv data can t be converted into the type datetime from the SQL column. But I defined the columns exactly like in the sample from the wiki. So the first column is Symbol varchar(50) and the second column is Date datetime (just wanna mention that my primary key is the Symbol). So there seems to be an error in the script as well?

It would be nice if anybody could help me with the WL data to SQL export issue. Maybe the script does not work anymore so maybe anybody has a working script to do the export to a database?

Thanks.
profile picture

Eugene

#2
The strategy code is working, there's nothing to fix in it. Note that your data file should be comma-separated and uniform.

Re: varchar. You set the Length of the field in the database. That's how it becomes a "10" or "50". Nevertheless, (10) vs (50) does not matter - unless your datasource contains symbols with really lengthy names (e.g. QuoteMedia's option tickers is the first thing that comes to mind).

Re: error message "column 9.4525 already exits". I think you're translating it into English, are you? It rather sounds like SQL Server prevents you from entering a duplicate value in the column. Columns in your database must not have a UNIQUE constraint/index.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).