Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. call select_all_exclude_one('vegas', 'uniqueIdentifier', @exclude_fields);
  2.  
  3. set @file_input = 'C:/MRTK_Enigma_IRD_VegaOSWP_New_Format.csv' ;
  4. set @field_terminate = '|';
  5. set @line_terminate = '\n';
  6. set @date_format = '%Y%m%d %H:%i:%s';
  7. set @columns_input = 'deskCode, bookName, riskType, riskTypeShiftSizeInBP, productCode, currency,
  8. maturity, maturityUnderlying, riskValue, currencyRiskValue,
  9. issuerCategory, countryOfIssuer, ratingCategory, postDate,
  10. @the_date, strike, currencyBase, indexCategory, EOL';
  11.  
  12.  
  13. set @sql = concat('LOAD DATA INFILE ''', @file_input, '''
  14.  
  15. IGNORE
  16.  
  17. INTO TABLE skewrisk.vegas
  18. FIELDS TERMINATED BY ''', @field_terminate, '''
  19. LINES TERMINATED BY ''', @line_terminate, '''
  20. IGNORE 1 LINES n(', @columns_input,
  21.  
  22. ')nset lastUpdate = str_to_date(@the_date, ''', @date_format, '''),
  23. uniqueIdentifier = MD5(concat(', @exclude_fields, '))');
  24.  
  25. select @sql;
  26. prepare stmt from @sql;
  27. execute stmt;
  28.  
  29. Action: prepare stmt from @sql
  30. Message: Error Code: 1295. This command is not supported in the prepared statement protocol yet
  31.  
  32. ALTER TABLE skewrisk.vegas ADD UNIQUE (
  33. deskCode, bookName, riskType, riskTypeShiftSizeInBP, productCode, currency,
  34. maturity, maturityUnderlying, riskValue, currencyRiskValue,
  35. issuerCategory, countryOfIssuer, ratingCategory, postDate,
  36. strike, currencyBase, indexCategory, EOL, lastUpdate
  37. );
  38.  
  39. LOAD DATA LOCAL INFILE 'file'
  40. INTO TABLE table_name
  41. FIELDS TERMINATED BY ','
  42. OPTIONALLY ENCLOSED BY '"'
  43. LINES TERMINATED BY '\r\n'
  44. (unique_id, date, col1, col2, ... )
  45. SET unique_id = CONCAT(date,col1,col2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement