# 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:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tonymarshall](https://clarionhub.com/user_avatar/clarionhub.com/tonymarshall/32/3786_2.png) [@Tonymarshall](https://clarionhub.com/u/Tonymarshall)\
**Post date:** [June 19, 2023, 1:10pm UTC](https://clarionhub.com/t/importing-ms-sql-database-into-clarion-database-tps/6325/1 "2023-06-19T13:10:00Z")

</div>

Hi Again Guys and Dolls  
I just need guidance on how to import a MS Sql database into a Clarion (TPS) database.  
I am using Clarion 8

Kind regards

---

<div class="post-metadata">

**Author:** ![donridley](https://clarionhub.com/user_avatar/clarionhub.com/donridley/32/1459_2.png) [@donridley](https://clarionhub.com/u/donridley)\
**Post date:** [June 19, 2023, 2:51pm UTC](https://clarionhub.com/t/importing-ms-sql-database-into-clarion-database-tps/6325/2 "2023-06-19T14:51:17Z")

</div>

Off the top of my head….

A

Import the SQL table into dictionary.  
Loop through SQL table and insert into TPS

B (If you have jFiles)

Query the SQL table where the results are returned as JSON.  
Import the JSON into TPS using jFiles.

(Note: You don’t have to have jFiles but it sure does make it easier.)

[https://www.capesoft.com/accessories/jFilessp.htm](https://www.capesoft.com/accessories/jFilessp.htm)

C

Export SQL to CSV.  
Loop through CSV and insert into TPS.

I’m sure there are other ways.

---

<div class="post-metadata">

**Author:** ![Tonymarshall](https://clarionhub.com/user_avatar/clarionhub.com/tonymarshall/32/3786_2.png) [@Tonymarshall](https://clarionhub.com/u/Tonymarshall)\
**Post date:** [June 20, 2023, 4:44am UTC](https://clarionhub.com/t/importing-ms-sql-database-into-clarion-database-tps/6325/3 "2023-06-20T04:44:55Z")

</div>

Thanks so much Donald. Will try it. Have a blessed day.

---

<div class="post-metadata">

**Author:** ![Tonymarshall](https://clarionhub.com/user_avatar/clarionhub.com/tonymarshall/32/3786_2.png) [@Tonymarshall](https://clarionhub.com/u/Tonymarshall)\
**Post date:** [July 19, 2023, 4:01pm UTC](https://clarionhub.com/t/importing-ms-sql-database-into-clarion-database-tps/6325/4 "2023-07-19T16:01:11Z")

</div>

Thanks Don for all your help

---

<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…
