PDA

View Full Version : Install MSSQL table records



NewsArchive
11-17-2007, 07:04 AM
In TPS, Its easy to install a table with records.
But how can i install some records in a table - my present need is a table
of zip codes.

Edvard Korsbęk

NewsArchive
11-17-2007, 07:05 AM
Edvard,


I have been using two ways doing this, depending on needs:


1. If you are using FM3 in your app, you can distribute TPS file
with zipcodes and FM3 will copy them to your database.

2. Write a SQL script file for zip code inserts and run it from your app
via OSQL.EXE command line utility at initial start up.


Hope that this will help.



Timo Lahtinen
Helsinki Finland

NewsArchive
11-17-2007, 07:05 AM
....and to install a zipcode update only: <g>

Write a SQL script file for zip code inserts and run it
via OSQL.EXE command line utility.


Sorry, it's too early here... <g>


Timo Lahtinen
Helsinki Finland

NewsArchive
11-19-2007, 01:59 AM
My problem is a table of say 2000 records.
Is there a way to script it including the records?
Perhaps basic MSSQL knowledge, but i have not found out where to look.

Edvard Korsbęk

NewsArchive
11-19-2007, 02:00 AM
Edvard,


I'm afraid you'll need 3rd party tools for this, such as Aqua Data Studio.
I have version 4.7.2 which used to be free, so it's worth of giving a
look...
Aqua Studio has option to "export" data into SQL Insert statements.

I have attached an example MSSQL script file that shows how to create table,
add primary key + one unique key and insert some rows.
Insert part is taken from Aqua Data Studio script.

Hope this helps.


Timo Lahtinen
Helsinki Finland

NewsArchive
11-19-2007, 02:02 AM
How about executing the MSSQL command-line bulk copy utility? It's named
"bcp". If you have MSSQL installed, just type "bcp /?" at a command prompt
to get the switches and format.

HTH.

Chris Rybitski

NewsArchive
11-20-2007, 02:15 AM
I would also recommend taking a look at sqlcmd rather than osql. It
supports more options.

sqlcmd /? at the command prompt will give you a list of options, or look at
http://msdn2.microsoft.com/en-us/library/ms162773.aspx for a complete
description of how it works and all it's options. There isn't much you
can't do with it!

-Glenn.