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)
 Converting data between two MS-SQL databases w/ dif. datatyp

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-02-21 : 08:48:53
Johnny O writes "I have two databases, which I need to take data from on database, and convert it to the other database. The problem is, the two databases have completly differnt data types. For instance, one database has a table, with two Columns, (Col_one_a), (Col_two_a). Col_one_a uses the binary data type (0,1 etc). Col_two_a uses a varchar for the description.

On the Second Database, I have a table with two columns (Col_one_b), (Col_two_b). In this database Col_one_b uses a varchar datatype. Entries in this column are true/false only. Col_two_b also has a varchar for the description, which is the same description as that in Col_two_a.

How would I write an SQL script to match the descrtions between the two, and convert all the binary's to true/false varchar datatypes?"

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2006-02-21 : 08:58:14
[code]
select
case when a.col_one_a = 1 then 'True' else 'False' end as Col_one_b,
a.col_two_a
from db1..table a
[/code]
Go to Top of Page
   

- Advertisement -