Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Exporting tables and then importing them.

Author  Topic 

silvershark
Starting Member

48 Posts

Posted - 2006-09-01 : 13:51:14
I am sucessfully able to export the tables that I am trying to modify using the following command in SQL interactive.

SELECT
v_str_mi_def.seq,
v_str_mi_def.obj_num,
v_str_mi_def.name_1,
v_str_mi_def.name_2,
v_str_mi_def.slu_num,
v_str_mi_def.nlu_grp,
v_str_mi_def.price_1,
v_str_mi_def.price_2,
v_str_mi_def.price_3,
v_str_mi_def.price_4,
v_str_mi_def.maj_grp_seq,
v_str_mi_def.fam_grp_seq
FROM micros.v_str_mi_def v_str_mi_def
where obj_num between 1 and 1000000
order by obj_num;
output to c:\mi_export.csv format ascii

I am simply trying to make a price change from the exported file and then import it back in. I have a lot of items and manually changing them would take entirely too long.

I then copy the export file and rename it to mi_import. This is the command I use after I have made the price changes to import the file into sql.

create global temporary table custom.mi_price_tmp (mi_seq seq_num,
obj_num int,
name_1 char (16),
name_2 char (12),
mi_slu_seq integer,
nlu_grp integer,
nlu_num integer,
price_1 money12,
price_2 money12,
price_3 money12,
price_4 money12,
maj_grp_seq integer,
fam_grp_seq integer);

input into custom.mi_price_tmp from c:\mi_import.csv format ascii;

update micros.v_str_mi_def as l
set l.obj_num = t.obj_num,
l.name_1=t.name_1,
l.name_2=t.name_2,
l.slu_num=t.mi_slu_seq,
l.nlu_grp = t.nlu_grp,
l.nlu_num=t.nlu_num,
l.price_1=t.price_1,
l.price_2=t.price_2,
l.price_3=t.price_3,
l.price_4=t.price_4
l.maj_grp_seq=t.fam_grp_seq,
l.fam_grp_seq=t.fam_grp_seq
from custom.mi_price_tmp as t
where l.seq=t.mi_seq;
drop table custom.mi_price_tmp

I am getting an int error on line 1. Can someone please look at this and see what I am doing wrong. The error message is stating that the first price that is listed in my table price_1 which happens to be 5.75 cannot change to int. So the error shows cannot change 5.75 to int.

Thanks.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-09-01 : 14:40:48
You don't seem to be using Microsoft SQL Server. This site is for Microsoft SQL Server questions.

You ahould post you question on a site for the type of database you are using. You might try dbforums.





CODO ERGO SUM
Go to Top of Page

silvershark
Starting Member

48 Posts

Posted - 2006-09-01 : 16:19:29
I thought most commands for SQL are pretty much generic across the board. Each version having its own revision of commands. But the process the same. I use SQL 2000, SQL 2005, SQL Pervasive 8, and SQL Interactive. The programming language has been pretty much the same for them as far as I can tell. Also, when converting SQL/Perl for websites the code seems to apply... ?
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-09-01 : 16:46:07
None of the statements you posted are valid for SQL Server.

That is why I could tell you are not using SQL Server.



CODO ERGO SUM
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-09-01 : 16:50:49
quote:

The error message is stating that the first price that is listed in my table price_1 which happens to be 5.75 cannot change to int. So the error shows cannot change 5.75 to int.



Don't you need to use a different data type? In SQL Server, you'd want to use decimal. Integer data is for whole numbers.

Tara Kizer
Go to Top of Page

silvershark
Starting Member

48 Posts

Posted - 2006-09-01 : 18:16:54
Ahh, very true. I cant believe I overlooked that.

Thanks.

I will try decimal format.
Go to Top of Page

silvershark
Starting Member

48 Posts

Posted - 2006-09-01 : 18:46:09
BTW, I am running Sybase SQL.
Go to Top of Page
   

- Advertisement -