Solved

Store a value to the Database and not a table...

Posted on 2011-09-13
3
288 Views
Last Modified: 2012-05-12
MS SQL 2008.  

I am storing a current Version Id to my database, and it is just a single value.  I was hoping to not have to create a table just to house one value.  Is there an elegant solution for storing one single value to a special point in the system tables? Database Variables, sort of like session variables?

Ultimately, this has to do with an installation manager needing to know which version is currently installed.

If you have an answer, please provide how to set the value, and how to retrieve/update it, if it is not standard SQL.
0
Comment
Question by:hpdvs2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Assisted Solution

by:JestersGrind
JestersGrind earned 50 total points
ID: 36530035
Really the only way to store values on a permanent basis is in a table.  Having a table store one value is not that unusual.  You could make that table name general enough that maybe you store other similar values later.  

Greg

0
 
LVL 5

Accepted Solution

by:
DerZauberer earned 450 total points
ID: 36530121
I think a table is simply the best way to store a value!

Well of coz you could create a user defined function in your db returning this value or some other strange thing like that.

CREATE FUNCTION GetVersion
(
)
RETURNS double
AS
BEGIN
RETURN 1.2
END

Open in new window


retrieve:

EXEC GetVersion

Open in new window


0
 
LVL 8

Author Closing Comment

by:hpdvs2
ID: 36530295
Thanks, at present I would agree that the sproc seems to make the most sense.

Thanks.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question