From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Database programmatically

I know this question has appeared many times before, but I still couldn't find a good answer.

 

How can LabVIEW create-/connect to-/insert data to- a new data base runtime, when the old one is full (>10GB) and nobody is around to create a new data base manually using Windows tools?

0 Kudos
Message 1 of 5
(3,200 Views)
You'll definitely need to tell us more. Which database engine are you using? Most engines have a way to connect to the engine, without connecting to a specific database (or even WITH connecting to the old database), then running a sql script like CREATE DATABASE new_database_name; After that you activate that database as the current one. Mysql uses the "USE new_database_name" syntax, but others differ. After that create the tables, and you should be sorted. I don't think this is specifically a labview question as much as a database question.
0 Kudos
Message 2 of 5
(3,188 Views)

I'm using Microsoft SQL Server 2008 R2 with LabVIEW connectivity toolset. 

 

Thank you for your answer, at least now I know where to look for a solution. I'll dig a little deeper in the Microsoft SQL server documentation.

0 Kudos
Message 3 of 5
(3,178 Views)

The simplist ways are usually the best.  What I have done is to have an empty database stored on the machine and do a simple copy/re-name of the empty to the next active one.  It's much easier then trying to create a new one on the fly.  Of course you would need to do something with the orginal before copying the empty one.  I use local Access files and this may not apply to your situation (but it may be of help to others).

 

0 Kudos
Message 4 of 5
(3,171 Views)

I'm a little confused why this is necessary.  In my many years of SQL Server admin, I have never seen a need for this.

 

SQL Server databases can grow well beyond 10 GB.  By default, database are created to grow automatically when the datafiles reach a certain point... they don't need to "fill up".  However, if you really wanted to prevent your DB from growng too big, I would prefer to build in some kind of routine for exporting old data and shrinking the database automatically, rather than creating a new empty database.

http://www.medicollector.com
0 Kudos
Message 5 of 5
(3,076 Views)