I'm trying to work with a web designer to get data copied from their system to ours (SQL Server 2000). She's giving me a file in what she called postgres format, which I've never worked with. I can get the CREATE TABLE statements to work with some tweaking, but I can't get the actual data. She's giving me a text file that looks like:
COPY manager (id, name, username, "password", access_level, affiliate) FROM stdin;
1 SunMie sunmie pw 5
2 Manager manager pw 5
\.
which I can't get Query Analyzer to get happy with. Am I missing something, or does she need to provide me with the data in a different format?if you have all the tables created but no data in them, you might be able to use bcp.exe to get the data in. bcp takes delimited files as input and will bulk insert to the table of your choice. as I recall, you can tell it what line to start on, and what line to end on.
look up "bcp utility" in bol for more info.
one catch may be that you are using a space to delimit the field values. it might make more sense to use some other char, like tab or "|". basically you need to choose a delimiter that won't appear in any of your text fields.
EDIT: i hope those aren't real passwords you posted... you might want to edit them if they are!|||The actual text file appears to be tab delimited. I think this forum condensed it when I posted. I will look at bcp, though my problem will be that the text file she sent contains this type of thing for multiple tables (actually it starts with create table statements). I guess in postgres you could just execute the text, and it would create/populate each table in turn. Given that the start and end point for each table would change, I'm not sure bcp will work without my manipulating the data in some way, which I was hoping to avoid.
Thanks for the help!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment