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
 SQL Server Development (2000)
 merge 2 fields from 1 tbl and store in diff tbl

Author  Topic 

slashman26
Starting Member

2 Posts

Posted - 2008-07-09 : 10:10:38
Hello,

sorry if the subject is mis-leading. Here is what I would like to be able to do and not sure how to do it.

I want to take 2 diferent values and merge them together and store them in a seperate table later to qurery against those results. Reason for this is because the qurery of the results is happening on a different server and database then the 2 fields are.

Here is the situation in more detail...

We have a core business system with Orders and invoices in them. An order number and invoice number can be the same number but NOT be related to each other (i.e the same number could be an order number for customer 1 and invoice for customer 2. Don't ask why that is because I don't know why it is)... anyway I need to merge those numbers with a seperate flag field that tells it what document it is (I=invoce, O= order etc). The reason for this merge is because I have a separte system that is going to be looking for that "Merged" value from a barcode on a scanned document from a different database.

So the here is what I am looking for:

F document_Number
I 00003
O 00003
I 00004
O 00004
...
So the above result would be:

Merged_field_in_different_database
I00003
O00003
I00004
O00004
...

Any ideas on how to make this work? This type of stuff i'm not sure is possible in SQL 2000 so that is why I am asking. Thanks in advance!

Jay

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-07-09 : 10:26:13
select F + document_Number from table.

But why merge them into a seperate table? If you have these in a different database on the same server, just use select F + document_Number from database.owner.table, if they are on seperate servers and you have a linked server (which i'm guessing you must do), use select F + document_Number from linkedserver.database.owner.table

If the datatypes are different, then use convert()
Go to Top of Page

slashman26
Starting Member

2 Posts

Posted - 2008-07-09 : 10:41:51
The database server are seperate servers. The one that will be doing the query will be pulling information from the other system (automated) in the early morning hours. The query of the scanned number happens anytime durning normal hours. So the result has to be stored. The server we are pulling information from is across a long VPN so the servers are not even in the same location, hence why I would like to store the information.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-07-09 : 10:46:39
well, just use the query I gave you.

select F + document_Number as newfield from table
Go to Top of Page
   

- Advertisement -