This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
notes:postgres [2015/08/11 14:18] jiggak |
notes:postgres [2015/08/17 14:05] jiggak |
||
---|---|---|---|
Line 3: | Line 3: | ||
create role josh with login; | create role josh with login; | ||
create database edc owner josh; | create database edc owner josh; | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | bcp " | ||
</ | </ | ||
<code bash> | <code bash> | ||
- | -- run bcp in windows cmd to dump table | + | #!/bin/bash |
- | bcp Campaign out campaign.data -c -k -S (localdb)\Projects | + | |
- | -- convert line endings to unix | + | for f in *.data; do |
- | dos2unix | + | echo $f |
- | -- import data with psql | + | cat $f | \ |
- | copy campaign | + | sed ' |
- | </code? | + | # remove extra at end of file |
+ | sed '$ s/ | ||
+ | # add missing at start of file | ||
+ | sed '1 s/ | ||
+ | sed ' | ||
+ | sed ' | ||
+ | sed ' | ||
+ | sed ' | ||
+ | sed ' | ||
+ | sed ' | ||
+ | sed ' | ||
+ | # dos2unix identified these non-char bytes | ||
+ | tr -d ' | ||
+ | # dos2unix | ||
+ | iconv | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | <code sql> | ||
+ | \copy event (id, | ||
+ | select setval('event_id_seq', (select max(id) from event)); | ||
+ | </code> |