# Importing MS Sql database into Clarion database (.TPS)

**URL:** <https://clarionhub.com/t/importing-ms-sql-database-into-clarion-database-tps/6325>\
**Category:** questions\
**Created:** [June 19, 2023, 1:10pm UTC](https://clarionhub.com/t/importing-ms-sql-database-into-clarion-database-tps/6325 "2023-06-19T13:10:00Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [July 19, 2023, 4:40pm UTC](https://clarionhub.com/t/importing-ms-sql-database-into-clarion-database-tps/6325/5 "2023-07-19T16:40:50Z")

</div>

> [@donridley](#):
>
> Import the SQL table into dictionary.  
> Loop through SQL table and insert into TPS

An easy way to “Loop through SQL table and insert into TPS” …  
… is to use a Process Template to create a Procedure that Reads the SQL and does an ADD to the TPS.

The DCT has the ability to “Generate Conversion Program” that makes a Standalone EXE with the file definitions. Best for a 1 time thing. Its all source so if the file definitions change you’ll have to edit the source. The above Process template procedure uses the DCT for file specs so is more future proof.

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/3/3fa5d036ec10ea2da9b0b33d3bfa7e75020834bd.png)

> [@donridley](#):
>
> Export SQL to CSV.  
> Loop through CSV and insert into TPS.

The CSV import method can make use the DCT Import feature as shown in the below topic.

> [@How to import CSV into Clarion 11 TopSpeed file without writing code](https://clarionhub.com/t/how-to-import-csv-into-clarion-11-topspeed-file-without-writing-code/3942/7):
>
> TopScan has an Export to CSV that I often use, I agree it would be very useful if there was also an Import. My method is not “code free” but it is mostly generated. Define the CSV File in the DCT (see import below). The DCT lets you browse file to see its right. For a 1 time convert use the DCT conversion, or if you’ll be doing this often… In an APP generate a Process to Read the CSV and Add to the TopSpeed. You’ll have to code those assignments and convert types. To help you can wizard a Bro…

---

_[View the full topic](https://clarionhub.com/t/importing-ms-sql-database-into-clarion-database-tps/6325)._
